.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

When creating a custom workflow activity, how can I specify a workflow variable as a parameter?

Posted By:      Posted Date: April 14, 2011    Points: 0   Category :C#

I have a functioning custom workflow activity developed in VisualStudio, deployed successfully and visible in SharePoint Designer.

My problem is that I'm trying to collect a Workflow Variable of type Number from SPD as a parameter for the activity, and can't find the right combination of values for my .ACTIONS XML file...

As a simple example/test WF Activity, I'm trying to just increment a variable and return the new value to another variable. Since this is an increment (variable++) I want both variables to be defined of type Number in SPD, not String. For an example of what I want, take a look at the "Do Calculation" OotB WFA in SPD and it's (Output To _variable:_ ) , where clicking on the parameter placeholder displays a drop-down list of all Workflow Variables in the current WF.

If I set the FieldBind attribute DesignerType to Text (and the Parameter attribute Type to "System.String, mscorlib") then I get the textbox with the "..." and "fx" buttons, allowing me to select any Workflow Data variables.

But if I change that to Integer and "System.Int32, mscorlib" I get the same control, but nothing is available in the Workflow Data variables list. And if I use FieldBind.DesignerType="ParameterNames" and Parameter.Type="System.int, mscorlib" I get an empty drop-down-

View Complete Post

More Related Resource Links

Custom sequence activity deriving from System.Workflow.Activities.SequenceActivity

Hi, I try to create custom sequence activity. I found some sample (http://social.msdn.microsoft.com/Forums/en-US/wfprerelease/thread/f54e8eb2-29d9-46f6-ad96-766fe6fad333/). But this custom activity looks ugly (to separate nested activity using ellipses instead of arrows). My question is - how to create custom sequence activity, which will look like sequence activity. I also found this sample - <ContentPresenter x:Uid="ContentPresenter_1" Content="{Binding}" Style="{x:Static sacdt:DesignerStylesDictionary.SequenceStyle}"/> When I used this ContentPresenter my custom activity looks like System.Workflow.Activities.SequenceActivity, but I couldn't put on it another activity. I also created class, which derives from System.Workflow.Activities.SequenceActivity, but I couldn't see it in toolbox. My question is - how to create class, which derives from System.Workflow.Activities.SequenceActivity and is visible in toolbox or how to use ContentPresenter for sequence activity, which allows put on itself another activity.

Custom Workflow Activity dependency property FieldNames

I have a custom actvity in VS2008. All is well until I added a new dependancy property like so: public static DependencyProperty EventLookupColumnNameProperty = DependencyProperty.Register("EventLookupColumnName",typeof(string),typeof(FTFSyncEventToAttachmentListItem)); public static DependencyProperty EventLookupColumnIDProperty = DependencyProperty.Register("EventLookupColumnID",typeof(string),typeof(FTFSyncEventToAttachmentListItem)); [Description("Event Lookup Column Name")][DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)][Browsable(true)][ValidationOption(ValidationOption.Required)]public string EventLookupColumnName{get { return ((string)(base.GetValue(EventLookupColumnNameProperty))); }set { base.SetValue(EventLookupColumnNameProperty, value); } [Description("Event Lookup Column ID")][ValidationOption(ValidationOption.Required)][Browsable(true)][DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]public int EventLookupColumnID{get { return ((int)(base.GetValue(EventLookupColumnIDProperty))); }set { base.SetValue(EventLookupColumnIDProperty, value); }}Then in the actions file:    <Action Name="FTF Sync Event To Attachment List Item"   ClassName="DP.Sharepoint.Workflow.FTFSyncEventToAttachmentListItem"   Assembly="DP.Sharepoint.Workflow, Version=, Cultur

Flowchart workflow, custom "FlowDecision" activity?

Dear all, in order to simplify the workflow "design" we would like to build our own activities that return a result with one or more nodes. Something like the "True/False" nodes that come out of the FlowDecision Activity. I know that one could normally add a FlowDecision activity after our custom activity and insert the condition expression to redirect the flow based on the result... however this requires the ability to know the "content" of the previous activity, and for some users we're targeting it's not immediate. Thank you!Adriano

Problem while creating task with custom content type in sharepoint workflow


Hi all,

I am trying to create task with custom content type in sharepoint statemachine workflow. But it is showing "Error Occured" after task creation code is excecuted. can anyone tell me what is the problem.

Task Content type


  <ContentType  ID="0x01080100A707C0079E8547c0A87515457DB90629"
      Description="Workflow Task"
      <FieldRef ID="{9da97a8a-1da5-4a77-98d3-4bc10456e700}" Name="MyComments" DisplayName="MyComments"  />
      <XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms/url">
        <FormUrls xmlns="

Custom Workflow Activity Works 'Manually' but can't be fired using CodePlex's 'Start Another Wo


Consider 2 lists.  In one list, a workflow runs on an item and if conditions are right, it creates an item in another list, pauses for 5 min, then starts another workflow on that newly created list item (using CodePlex's old 'Start Another Workflow' routine).

All of that works great, used it many times in many situations without fail, so long as I put a pause between the item creation and calling the workflow on the newly created item.

I've started writing my own custom workflow activities, all of them work just fine, up to 5 now, really useful to do little things that SPD Workflow can't do by itself.  The 5th one I added was a very simple 'Now' routine.  The class itself is called 'GetNow' and has a 'RightNow' property that's DateTime and it works great.  I have the need to stamp something with the current date/time, and I haven't modified the underlying record yet, and setting a Date/Time variable only takes Today or a static date/time, with 'Today' returning the current date, but '12 am', which is redunculous, but I digress.

So my step compiles, updated my .ACTIONS file which holds the definition for the other 4 custom routines.  I have the context 'in' parameter and one 'out' parameter for 'RightNow' defined as System.DateTime (which I think is where the problem is, possibly), and it all works if I

Creating a custom Workflow + Custom workflow task + complete = error


Hi everyone,

I am using a custom workflow in SharePoint 2010, with one task in it using a Custom Content type deriving from the "Workflow Task" type, with a custom Edit form.

From this point everything is fine, I can create my Task, open it from the task list with my custom webpage as form, but when I want to update my task to complete it, i get a very weird message that I didn't find any help about: "The workflow's parent item associated with this task is currently in the recycle bin, which prevents the task from being completed".

I Just have my Custom workflow using a Custom Workflow task, I don't see where this should come from... I even looked in the Recycle Bin, but it was empty as I was thinking it would be...

Any chances someone got a solution on this?

Cheers, Ben

Error: Workflow Custom Activity



I have a custom activity, which is available under Designer Actions.
I can see and set parameters. However on the Finish step, I encounter following error:

Errors were found when compiling the workflow. The workflow files were saved but cannot be run.

On clicking Advanced, I get this:
(14, 47) The type name 'SendMailWithAttachmentActivity' does not exist in the type 'SendMailWithAttachmentActivity.SendMailWithAttachmentActivity')

Here is Action tag:

   <Action Name="Send Attachments"
      Assembly="SendMailWithAttachmentActivity, Version=, Culture=neutral, PublicKeyToken=ff5f77ebcbc6469d"
      Category="Email Actions">
      <RuleDesigner Sentence="Send Attachs to %1 besides %2">
        <FieldBind Field="EmailID" Text="people field" Id="1" DesignerType="TextArea"/>
        <FieldBind Field="Junk" Text="enter jun

the joy of writing a custom workflow activity for SharePoint Designer...


So, I need an activity that will replace some old text into new text in a given string.
Not present OOTB in SharePoint Designer, so - oh boy! oh boy! - we can develop it ourselves using Visual Studio!

Ok great, I did some reading about it on SP2007 in the past, but never needed it, so never actually tried it.
Now I'm on SP2010, so I googled again to find guides on how to write my very first custom workflow activity to use in SharePoint Designer 2010.
Nothing to be found.... The few posts about 2010 were only stating that it works still the same as in SP2007, and to look for guides on 2007.

Ok, so I googled some guides on how to do this in SP2007. I found one from MSDN, perfect to start with you'd say: http://msdn.microsoft.com/en-us/library/cc627284.aspx 
But really, it doesn't work the same... When I create an Activity Library project in VS2010, I don't have a class, like in the guide. All I have is a xaml file, no cs at all, and I have absolutely no clue what I should add in order to get the same class as in the guide. Adding a regular class is not it, since in the guide they're using a partial class. So I'm blocked 5secs after I started reading the guide... just great.

I'm so fed up with the lack of information on development for SharePoint. I hit

Is there a plan to support a custom activity type as a root document in xaml on VS workflow designer



Referring to the post below. It seems that the current VS workflow designer only support "Activity" type as a root document. Is there a plan to support a custom activity type as a root document in xaml on next release of WF?




Custom Invoke Workflow Activity


I need to develope the custom invoke activity with the existing functionality as in original workflow and need to add few more dependency properties to the custom one.

Using the reflector, I had explored the required classes to get the InvokeWorkflow activity build successfully in my project. I also got it on the tool box when I build my project in VSX. But the problem is that, when I select the target workflow, my custom invoke workflow designer does not get refreshed, and so, not the property window. Actually, when you choose the target workflow, the designer gets refreshed and shows the properties of the target workflow in the property window of invoke workflow and then you can map the properties of invoke workflow with the properties of target workflow.

Also, I am a bit confused as the InvokeWorkflow does not carry InvokeWorkflowDesigner attached as an attribute of a class. I think it is being assigned by some of the parent of InvokeWorkflow class - may be Activity class.

Any help will be really appriciated.

I had spend enough time, and still will continue.

Darshit Dave

Custom Workflow Activity Designer Serialization Issues


I have an activity which has collection properties as below


    public sealed class TaskActivity : NativeActivity
        public TaskActivity()
            TaskParameters = new ObservableCollection<PMTaskParameter>();
            TaskExceptions = new ObservableCollection<Guid>();

How to get workflow instance in custom activity?


I am using Sequential workflow (.net 3.5). I have created 3 custom activities and dragged these activities in my sequential workflow. The activities are




Each Custom activity will have the following execute method. 

protected override ActivityExecutionSt

Windows Workflow: Build Custom Activities To Extend The Reach Of Your Workflows


This article covers the core components required for building custom activities in Windows Workflow Foundation.

Matt Milner

MSDN Magazine December 2006

Sharepoint Wiki Custom Workflow


Has anyone done custom workflows for a sharepoint Wiki page? 

The workflow I'm trying to do is, whenever a new wiki page is created I want a new Discussion page  to be created for that wiki page?

Any Help?

Proper setup using Infopath and Custom Workflow using VS 2008



I have been struggling for a couple of days, trying to set up a decent
structure for an Infopath project using a custom workflow using Visual Studio 2008.

I had a solution with two projects:

1) Sharepoint 2007 Workflow

2) Infopath 2007 form w/code-behind.

I included the xsn, in the VS solution, but after a day or two,
something went wrong, and I lost some work. I still do not know what
happened, but I could not get my changes to persist afterthat  Doing research I have read that this
stucture, using Infopath xsn, within VS does not work correctly with Source
Control. I am using VSS.

So I since made a change to the set-up so that the .xsn (form template) is separate from
Visual Studio. However, I need to leave the code-behind in VS, since I need to debug

This is my latest problem. I have been unable to attach to the correct
process, as VS generates cachse files, and who knows what else.

My question is simple. What is the supported method for debugging InfoPath
code/behind, which uses a Sharepiont Workflow?

I just also want to say that one should not have
to spend a few days just trying to setup a working development environment.

This should be trouble-free, but it is far from being so. I

Assigning users when creating a list item in a workflow


I'm using a workflow to assign tasks to users.  When I try to assign the task to a group (set in the workflow designer), the workflow gives me an error.  When I change the assign to property to a single user, the workflow works perfectly.  How do I get the workflow to assign the task to the group?  Or if that's not possible, can I get it to assign it to more than one user?


Infopath button click event in custom workflow code.


Hi All,

I have designed the infopath form(Init) and integrated with my state machine workflow. i want to access button click event (designed in Infopath form) in my workflow code.

Can you help me.




ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend