Question

My solution requires me to create a custom action for SharePoint Designer for a list. I have treed creating the custom action the old fashioned way (200 method) by creating the action and deploying it as a Farm Solution. Eventually (after many attempts and errors), I was able to get the custom action to appear for SharePoint Designer. However once I selected the action, SharePoint Designer would not show the sentence. Then I read about sandboxed solutions being able to deploy actions. Great! It even looks less complicated! However, even after following the directions from Microsoft, I am unable to get the SPD 2010 to show the sentence add the action to the workflow editor. I copy and pasted the code present on that page.

I'm losing my mind here......

Was it helpful?

Solution

I got a tumbleweed award with this one....

After much gnashing of teeth, it comes down to making sure that the xml in the Action file ( or elements file if you throwing it on via a sandboxed solution) needs to be perfect. It is the weakest link in the whole process.

I eventully went with a sandboxed solution. It provided me with enough functionlity to get the job done. Below is an example of the correct way to declare an Action for a sandbox solution.

In this case the Action elements attributes ("Name","SandboxedFunction", etc) need to be accurate)

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <WorkflowActions>
    <Action Name="Create a List"
        SandboxedFunction="true"
        Assembly="$SharePoint.Project.AssemblyFullName$"
        ClassName="PMOCustomActions.ListCreation"
        FunctionName="CreateList"
        AppliesTo="all"
        UsesCurrentItem="true"
        Category="Resource Allocation">
      <RuleDesigner Sentence="Create a %1 list named %2, and described as %3">
        <FieldBind Id="1" Field="listType" DesignerType="Text" Text="list type"/>
        <FieldBind Id="2" Field="listTitle" DesignerType="Text" Text="list name"/>
        <FieldBind Id="3" Field="listDescription" DesignerType="Text" Text="description"/>
      </RuleDesigner>
      <Parameters>
        <Parameter Name="__Context" Type="Microsoft.SharePoint.WorkflowActions.WorkflowContext, Microsoft.SharePoint.WorkflowActions" Direction="In" DesignerType="Hide" />
        <Parameter Name="listType" Type="System.String, mscorlib" Direction="In" DesignerType="TextBox"/>
        <Parameter Name="listTitle" Type="System.String, mscorlib" Direction="In" DesignerType="TextBox" />
        <Parameter Name="listDescription" Type="System.String, mscorlib" Direction="In" DesignerType="TextBox" />
      </Parameters>
      </Action>
    </WorkflowActions>
</Elements>

Things to watch out for:

  • Action elements attributes ("Name","SandboxedFunction", etc) need to be accurate
  • Be sure to match your id's with place holders (%1) in the sentence.
  • Use the correct Types for both the RuleDesigner and the Parameters.
  • the __Context Parameter must always be there. It is the property bag for context information from the workflow.

If I remember the other gotchas, I'll come back and put them here.

Good luck.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top