Unknown Error

Nov 19, 2009 at 8:55 PM

Hi Vouter

I'm new to Sharepoint, and I'm trying your very nice tool, your sample code works perfectly, but for some reason I can't figure out when I try and create my own Project (I follewed the description in your video, workflow.xml is changed with <Task_0_FormUrl></Task_0_FormUrl>.)

I've tried several times, but with no luck when it comes to having a custom editform, in my latest project I left out the istantiation and association, to keep it very very simple, but still no luck, I'm pretty sure its a stupid mistake on my part,
but I have no idea where to start, I tried to debug the project, but it says unable to start the .dll - same happens in your sample project.

Looking through the previous posts on the subject it seems like you want to see the workflow.xml, so here it is:

<font size="2" color="#0000ff"><font size="2" color="#0000ff">

<?

</font></font><font size="2" color="#0000ff">

 

</font>

xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<
Workflow Id="{1B81F0C4-D2B9-4466-84A6-066D1A18DF02}"
Name="WhyGovSecIssue"
Description="WhGov Security Issue"
Title="WhGov Security Issue" 
CodeBesideAssembly="WhyGovSecIssue, Culture=neutral, Version=1.0.0.0, PublicKeyToken=43a0c7d92c9bdf8d"
CodeBesideClass="WhyGovSecIssue.Workflow1" TaskListContentTypeId="0x010801004E4FD5D508784092AA20394584759B99">
<
MetaData>
<
Task_0_FormUrl>/_controltemplates/WhyGovSecIssue/ManApprovalTaskControl.ascx</Task_0_FormUrl>
</
MetaData>
</
Workflow>
</
Elements>

Any help is greaty appreciated.

Coordinator
Nov 19, 2009 at 9:18 PM

My guess is that the markup in the custom .ascx file has a problem.  If you haven't already, make sure you change the debug and callstack settings in your web.config file.  This will allow a better error message to be shown.  If that error message doesn't help, go ahead and post it and the .ascx file.

Nov 19, 2009 at 10:32 PM

Hi Chris,

Thanks for you quick reply, in the meantime I tried following the video combined with the changes according to the sample code, I'm getting the following error:

Object reference not set to an instance of an object.   at TPG.SharePoint.Workflow.TaskData.GetProperty(Object key)
   at TPG.SharePoint.Workflow.TaskData.get_Item(Object key)
   at ASP._controltemplates_whygovprojtest_whygovtaskcontrol_ascx.LoadData(Boolean isInitialLoad) in c:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\CONTROLTEMPLATES\WhyGovProjTest\WhyGovTaskControl.ascx:line 42
   at TPG.SharePoint.Workflow.WorkflowDataControl`2.OnLoad(EventArgs e)

In this try I implemented Association and Instatiation, which both runs fine, my workflow.xml is now:

<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Workflow Id="{9CA2B6CD-DF40-4dfd-B6B5-C10717E5E07D}"
            Name="WhyGovProjTest"
            Description="WhyGov Test Project"
            Title="WhyGov Test"
            CodeBesideAssembly="WhyGovProjTest, Culture=neutral, Version=1.0.0.0, PublicKeyToken=c4f4ffd246ce6401"
            CodeBesideClass="WhyGovProjTest.Workflow1"
            AssociationUrl="_layouts/WSS3Workflow/AssociationFormHost.aspx"
          InstantiationUrl="_layouts/WSS3Workflow/InstantiationFormHost.aspx"
            TaskListContentTypeId="0x010801004E4FD5D508784092AA20394584759B99">
    <MetaData>
      <Association_FormUrl>/_controltemplates/WhyGovProjTest/WhyGovConfiguration.ascx</Association_FormUrl>
      <Instantiation_FormUrl>/_controltemplates/WhyGovProjTest/WhyGovConfiguration.ascx</Instantiation_FormUrl>
      <Task_0_FormUrl>/_controltemplates/WhyGovProjTest/WhyGovTaskControl.ascx</Task_0_FormUrl>
    </MetaData>
  </Workflow>
</Elements>

The WhyGovTaskControl.ascx is, note I did try without my own assemblies, as I saw it was suggested, but in the sample code it's included, so I tried both ways:

<%@ Control Language="C#" AutoEventWireup="true" Inherits="TPG.SharePoint.Workflow.TaskControl, TPG.SharePoint.Workflow, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d3a33f5f62ef53ef" %>
<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls"
    Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="tpg" Namespace="TPG.SharePoint.Workflow.Controls" Assembly="TPG.SharePoint.Workflow, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d3a33f5f62ef53ef" %>
<%@ Assembly Name="TPG.SharePoint.Workflow, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d3a33f5f62ef53ef" %>
<%@ Assembly Name="WhyGovProjTest, Culture=neutral, Version=1.0.0.0, PublicKeyToken=c4f4ffd246ce6401" %>
<%@ Import Namespace="TPG.SharePoint.Workflow" %>
<%@ Import Namespace="WhyGovProjTest" %>
<%@ Import Namespace="Microsoft.SharePoint" %>


<tpg:InputForm ID="inputForm" runat="server">
    <tpg:InputFormSection ID="InputFormSection1" runat="server" Title="Instructions" Description="Please read and / or alter these instructions prior to approving or disapproving the item.">
        <ContentTemplate>
            <asp:Label ID="instructionsField" runat="server" />
        </ContentTemplate>       
    </tpg:InputFormSection>
    <tpg:InputFormSection ID="InputFormSection2" runat="server" Title="Comments" Description="Please enter any comments you may have.">
        <ContentTemplate>
            <tpg:InputFormControl ID="InputFormControl1" runat="server" LabelText="Your Comments">
                <ControlTemplate>
                    <asp:TextBox ID="commentsField" runat="server" Width="100%" Rows="5" TextMode="MultiLine" />   
                </ControlTemplate>
            </tpg:InputFormControl>
        </ContentTemplate>       
    </tpg:InputFormSection>   
    <tpg:ButtonSection ID="ButtonSection1" runat="server" ShowStandardCancelButton="false">
        <ButtonTemplate>
            <asp:Button ID="Button1" runat="server" Text="Approve" CommandName="Commit" CommandArgument="Approve" />
            <asp:Button ID="Button2" runat="server" Text="Reject" CommandName="Commit" CommandArgument="Reject" />
            <asp:Button ID="Button3" runat="server" Text="Cancel" CommandName="Cancel" />       
        </ButtonTemplate>
    </tpg:ButtonSection>
</tpg:InputForm>

<script type="text/C#" runat="server">
    protected override void LoadData(bool isInitialLoad)
    {
        if (isInitialLoad)
        {           
            TaskData data = GetData();
            commentsField.Text = data["Comments"] as string;
        }
    }

    protected override TaskData SaveData(object commandArgument)
    {
        TaskData data = new TaskData();
        data["Comments"] = commentsField.Text;
        data["Result"] = commandArgument;
        return data;
    }
</script>

Sorry to ask for help this late, but I'm really stuck, and will be extatic to be able to start working with your cool tool.

Klaus

Nov 19, 2009 at 10:49 PM

Hi Chris,

I'm sorry I think I was starring blind at the code, the problem which is probably obvious to anyone but me is that in LoadData if it's running for the first time will try to set a field value with a null value.

Thanks though for helping with displaying usefull errormessages, I have the callstack to false...

Have a good night.

Klaus :)