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'm developing a custom Sharepoint 2010 workflow activity and I need some of it's parameters to be optional. For example, I need a user, using Sharepoint Designer, to be able to specify document path, or document's id within list, together with list guid, but not both of them.

If I just use dependency properties and bind them in the .ACTIONS file for this activity, they are required by default. How can I avoid this, is there a better way?

share|improve this question

1 Answer 1

I tried to find a solution for this by first checking if I could have two Action element for same class and assembly but with different sentences like "find a document with id equal to %1 in list with guid equal to %2" and "find a document with path equal to %1 in list with guid equal to %2"... BUT this does not work because for a given class and assembly, sharepoint finds first appearance of ACTION element in the .actions file and displays that sentence only. so you may NOT want to take this route.

If you are willing to change the logic of your activity, here are some options.

Option 1

sentence = find a document with %1 equal to %2 in list with guid equal to %3

%1 = FieldName (string) and

%2 = FieldValue (string) and

%3 = list GUID (use your own names).

FieldName appears as a dropdown with value like "Document Path" and "Document ID" and expect user to select appropriate values. FieldName look like

<FieldBind Field="FieldName" Text="Input Type" DesignerType="Dropdown" Id="1">
          <Option Name="Document Path" Value="Path"/>
          <Option Name="Document ID" Value="ID"/>

Option 2 (I would prefer this)

sentence = find %1 document in list with guid equal to %2

%1 = FieldValue (string - so that path or id both can be provided)

In your code you will have to infer whether user provided ID or Document Path (I would try to parse as Integer and if success assume a id otherwise a path). On designer you can provide a hint to user using following:

<FieldBind Field="FielValue" Text="Document ID or Document Path" DesignerType="TextBox" Id="1"/>

Option 3

Write two separate activities FindDocumentById and FindDocumentByPath (choose your own name, of course)

share|improve this answer

Your Answer


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.