Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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?

share|improve this question
    
In case someone else runs into this question/answer, the only additional thing to do here (on top of what has already been mentioned), is to add a SafeControl entry in web.config. Hope that helps someone. –  adaptive Aug 3 '11 at 17:29
    
Were you able to find a solution to this? It doesnt happen on all of our webApps though –  DigitCat Jan 31 at 21:25
add comment

4 Answers

I have same issue but now i found it . if your custom action not inserting in workflow steps , sure it's not authorize and check name of assembly name in your authorize script for example if my assembly name is "CustomActionDemo.dll" , assembly name in authorize code must be exactly : "CustomActionDemo"

share|improve this answer
add comment

If it is showing up in the list of activities, and by selecting it, nothing happens, in my experience, an exception is being caught somewhere, and probably logged. So try selecting it, and go right to the SharePoint logs.

Another idea, is that SharePoint designer is finicky and I haven't been able to determine when things are/are not cached. Have you tried simply closing/reopening SPD?

I have a working example I can compare with when I get in to the office.

Edit 1

I think there may be an issue in your <Parameters> section. I think your field bind's need to match your Parameters. Here's an example I did that created a List based on a URL, and outputted to a bool variable. I remember having issues until the Field and Name properties matched, and they must match your dependency properties.

<RuleDesigner Sentence="Create List named %1 at site %2 (IsSuccessful out to %3)">
  <FieldBind Field="ListName" Text="Custom List" DesignerType="TextArea" Id="1" />
  <FieldBind Field="SiteUrl" Text="Site" DesignerType="TextArea" Id="2" />
  <FieldBind Field="IsSuccessful" Text="WasListCreated" DesignerType="ParameterNames" Id="3" />
</RuleDesigner>
<Parameters>
  <Parameter Name="ListName" Type="System.String, mscorlib" Direction="In" />
  <Parameter Name="SiteUrl" Type="System.String, mscorlib" Direction="In" />
  <Parameter Name="IsSuccessful" Type="System.Boolean, mscorlib" Direction="Out" />
</Parameters>

Edit 2

Try adding the following attribute to your properties

[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
[BrowsableAttribute(true)]

Edit 3

Can you try to manually clear out the cache? The this post

share|improve this answer
    
Hi Tim I've tried closing and reopening SPD but that didn't help. I've also had a look through the log files but can't see anything there either (although it's very possible I'm just not reading them right). –  Smully Jul 12 '11 at 13:12
    
By log files, I meant trace logs, and there were no errors in there –  Smully Jul 12 '11 at 13:18
    
Please see my Edit 1 block above –  Tim Gabrhel Jul 12 '11 at 13:30
    
Hi Tim Thanks very much for that. I've updated the actions file and re-posted it above. I've made sure the names match the dependancyproperty names (they didn't but now do) however I still have the same issue. –  Smully Jul 12 '11 at 13:44
    
Nope, tried adding those properties but nothing changed... Looks like I need to try what Muhimbi suggested and start from scratch. I'll post back if I get it working –  Smully Jul 13 '11 at 8:25
show 1 more comment
up vote 2 down vote accepted

I followed this link and managed to get this demo working:

https://msmvps.com/blogs/sundar_narasiman/archive/2010/12/26/develop-custom-workflow-activity-for-sharepoint-2010-workflow.aspx

Rather than manually copying everything to where it should be I used Visual Studio Deploy to install everything, and the extra project to hold the actions file in the correct folder.

All working now.

Thanks for everyones help

share|improve this answer
    
Using the above link as a guide, I can now deploy my own activities and use them in SPD. –  Smully Jul 14 '11 at 9:56
    
In case someone else runs into this question/answer, the only additional thing to do here (on top of what has already been mentioned), is to add a SafeControl entry in web.config. Hope that helps someone. –  adaptive Aug 3 '11 at 17:27
add comment

This is quite common when first developing an Action. Some things to check:

  1. Restart SharePoint Designer and IIS.
  2. Clear the SharePoint Designer Workflow Assembly Cache.
  3. Double check the strong name in the AuthorizedType element (use reflector to get the full signature of the Assembly).
  4. Check the syntax in your Actions file. It is my experience that if you get something wrong in there no errors are reported, it just doesn't work. (capitalisation, parameter types, etc)
share|improve this answer
    
Hi I've done lots of IIS resets and also restarting SPD but that didn't help. I've also removed the cache as suggested and used Reflector and that all seems to be correct. Any other ideas? –  Smully Jul 12 '11 at 13:12
    
Have a good look at your Actions file. Try simplifying it (or recreate from a working example) then start adding new bits until it stops working. Restart SPD in between each iteration. It is a pain, I even talked to MS Support people who are struggling with it. –  Muhimbi Jul 12 '11 at 14:27
    
Good idea, thanks, I'll give it a go –  Smully Jul 12 '11 at 14:35
    
+1 lots of great information in addition to Tim's answer. My money is on clearing the cache. –  Kit Menke Jul 12 '11 at 14:41
    
Well, simplifying it didn't help, which means there is a more fundamental problem... I added to my post –  Smully Jul 12 '11 at 15:37
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.