I've been following several examples regarding custom actions. I've been trying to deploy my own one, but although I can see the action inside SPD, when selected it doesn't appear in the workflow step.
What I am trying to do is to perform a field lookup in both CSVString and ReleaseID properties, and a list name lookup in SecondaryListName.
I have VS and SP both on the same development box so there aren't multiple front ends. There are several web applications but I have made sure I have updated the correct web.config.
The namespace I'm using is "CustomActivity" and the class (which is public) is called "StringIteration".
I have deployed the dll to the GAC successfully.
The CustomActivity.actions file looks like:
<?xml version="1.0" encoding="utf-8" ?>
<WorkflowInfo>
<Actions Sequential="then" Parallel="and">
<Action Name="String Iterate To New List Items"
ClassName="CustomActivity.StringIteration"
Assembly="CustomActivity, Version=1.0.0.0, Culture=neutral, PublicKeyToken=82239858eda182a1"
Category="My Custom Activities"
AppliesTo="all">
<RuleDesigner Sentence="Get CSV values from field %1 using request ID %2 and insert to list %3">
<FieldBind DesignerType="FieldNames" Id="1" Text="Field with CSV contents" Field="CSVString" />
<FieldBind DesignerType="ListNames" Id="2" Text="List to add new records to" Field="SecondaryListName" />
<FieldBind DesignerType="FieldNames" Id="3" Text="Release ID Field" Field="ReleaseID" />
<Parameters>
<Parameter Name="CSVString" Type="System.String, mscorlib" Direction="In" DesignerType="FieldNames" Description="Approver matrix list name." />
<Parameter Name="SecondaryListName" Type="System.String, mscorlib" Direction="In" DesignerType="ListNames" Description="Approver matrix fields." />
<Parameter Name="ReleaseID" Type="System.Int32, mscorlib" Direction="In" DesignerType="FieldNames" Description="Workflow variable output by this action." />
<Parameter Name="__Context" Type="Microsoft.SharePoint.WorkflowActions.WorkflowContext, Microsoft.SharePoint.WorkflowActions" Direction="In" DesignerType="Hide" />
</Parameters>
</Action>
</Actions>
</WorkflowInfo>
I have updated the relevant web.config with:
<authorizedType Assembly="CustomActivity, Version=1.0.0.0, Culture=neutral, PublicKeyToken=82239858eda182a1" Namespace="CustomActivity.StringIteration" TypeName="*" Authorized="True" />
Any help would be greatly appreciated
Thanks
EDIT: As with this question, I am able to break the workflow by changing the assembly name inside the actions file. This causes an SPD error to be generated, therefore it must be reading the assembly correctly (I think).
Custom workflow activity for SP 2007 appears in Designer's action picker but won't add
EDIT 2:
I have updated my actions file following Tim's comments, but the same thing still happens:
<?xml version="1.0" encoding="utf-8" ?>
<WorkflowInfo>
<Actions Sequential="then" Parallel="and">
<Action Name="String Iterate To New List Items"
ClassName="CustomActivity.StringIteration"
Assembly="CustomActivity, Version=1.0.0.0, Culture=neutral, PublicKeyToken=82239858eda182a1"
Category="My Custom Activities"
UseCurrentItem="true"
AppliesTo="all">
<RuleDesigner Sentence="Get CSV values from field %1 using request ID %2 and insert to list %3">
<FieldBind DesignerType="FieldNames" Id="1" Text="Field with CSV contents" Field="CSVString" />
<FieldBind DesignerType="FieldNames" Id="2" Text="Release ID Field" Field="ReleaseID" />
<FieldBind DesignerType="ListNames" Id="3" Text="List to add new records to" Field="SecondaryListName" />
</RuleDesigner>
<Parameters>
<Parameter Name="CSVString" Type="System.String, mscorlib" Direction="In" />
<Parameter Name="ReleaseID" Type="System.Int32, mscorlib" Direction="In" />
<Parameter Name="SecondaryListName" Type="System.String, mscorlib" Direction="In" />
<Parameter Name="__Context" Type="Microsoft.SharePoint.WorkflowActions.WorkflowContext, Microsoft.SharePoint.WorkflowActions" Direction="In" DesignerType="Hide" />
</Parameters>
</Action>
</Actions>
</WorkflowInfo>
EDIT 3: Okay, so this goes from worse to even worse. I've steadily removed properties from the actions file (and dependancyproperties from the dll) until there is 1 property left. I've set this to be a DesignerType of TextArea and the dependancyproperty is a string. I've cleared the cache, reset IIS... and still nothing.
So now I'm wondering if it's something else? the code for the dll is:
namespace CustomActivity
{
public partial class StringIteration : SequenceActivity
{
private string _updatedCSVString = "";
public static DependencyProperty CSVStringProperty = DependencyProperty.Register("CSVString", typeof(string), typeof(StringIteration), new PropertyMetadata(""));
[ValidationOption(System.Workflow.ComponentModel.Compiler.ValidationOption.Required)]
public string CSVString
{
get
{
return (string)base.GetValue(StringIteration.CSVStringProperty);
}
set
{
base.SetValue(StringIteration.CSVStringProperty, value);
_updatedCSVString = value;
}
}
public StringIteration()
{
InitializeComponent();
}
protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
{
CSVString = "Work please";
return ActivityExecutionStatus.Closed;
}
}
}
and the new, trimmed down actions file is:
<?xml version="1.0" encoding="utf-8" ?>
<WorkflowInfo>
<Actions Sequential="then" Parallel="and">
<Action Name="String Iterate To New List Items"
ClassName="CustomActivity.StringIteration"
Assembly="CustomActivity, Version=1.0.0.0, Culture=neutral, PublicKeyToken=82239858eda182a1"
Category="My Custom Activities"
AppliesTo="all">
<RuleDesigner Sentence="Get CSV values from field %1">
<FieldBind Field="CSVStringProperty" DesignerType="TextArea" Id="1" Text="Field with CSV contents"/>
</RuleDesigner>
<Parameters>
<Parameter Name="CSVStringProperty" Type="System.String, mscorlib" Direction="In" />
</Parameters>
</Action>
</Actions>
</WorkflowInfo>
Thanks for everyones help so far! Any last ideas?