Friday 22 February 2013

CreateTaskWithContentType (05)

Let's make this work

1.) Open up the elements file of your workflow, you should see something along the lines of:
<?xml version="1.0" encoding="utf-8" ?>
 
<!-- Customize the text in square brackets. 
Remove brackets when filling in, e.g.
Name="[NAME]" ==> Name="MyWorkflow" -->
 
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Workflow
     Name="SPM_Workflow"
     Description="My SharePoint Workflow"
     Id="d702d3ec-d6ab-4c34-9e73-5b8dcb0599ce"
     CodeBesideClass="WorkflowProject1.Workflow1.Workflow1"
     CodeBesideAssembly="$assemblyname$">
    <Categories/>
    <MetaData>
      <AssociationCategories>List</AssociationCategories>
      <!-- Tags to specify InfoPath forms for the workflow; delete tags for forms that you do not have -->
      <!--<Association_FormURN>[URN FOR ASSOCIATION FORM]</Association_FormURN>
       <Instantiation_FormURN>[URN FOR INSTANTIATION FORM]</Instantiation_FormURN>
      <Task0_FormURN>[URN FOR TASK (type 0) FORM]</Task0_FormURN>
      <Task1_FormURN>[URN FOR TASK (type 1) FORM]</Task1_FormURN>-->
      <!-- Modification forms: create a unique guid for each modification form -->
      <!--<Modification_[UNIQUE GUID]_FormURN>[URN FOR MODIFICATION FORM]</Modification_[UNIQUE GUID]_FormURN>
      <Modification_[UNIQUE GUID]_Name>[NAME OF MODIFICATION TO BE DISPLAYED AS A LINK ON WORKFLOW STATUS PAGE</Modification_[UNIQUE GUID]_Name>
      -->
      <StatusPageUrl>_layouts/WrkStat.aspx</StatusPageUrl>
    </MetaData>
  </Workflow>
</Elements>
we're going to add two things to this
  • our content type
  • our task form ID (remember way back in the first post I said make a note of it.)
ok so when done we should have something along the lines of

<?xml version="1.0" encoding="utf-8" ?>
 
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Workflow
     Name="SharePoint Magic WF"
     Description="My SharePoint Workflow"
     Id="d702d3ec-d6ab-4c34-9e73-5b8dcb0599ce"
     CodeBesideClass="SPM_WorkFlow.Workflow1.Workflow1"
     CodeBesideAssembly="$assemblyname$"
     TaskListContentTypeId="0x01080100d6b5580b746b4e68b032f3cdc88b6062">
    <Categories/>
    <MetaData>
      <AssociationCategories>List</AssociationCategories>
      <Task0_FormURN>urn:schemas-microsoft-com:office:infopath:SPM-Form:-myXSD-2013-02-21T15-34-28</Task0_FormURN>
      <StatusPageUrl>_layouts/WrkStat.aspx</StatusPageUrl>
    </MetaData>
  </Workflow>
</Elements>

deploy this, and you should be OK.