Sharepoint 2013 Workflow Custom Declarative Activity
In SharePoint 2013 it is possible to create custom declarative activities (in Visual Studio 2012), that will be exposed and can be used in SharePoint Designer Workflows. In this way we can extend SPD OOB Workflow Activities.
To create a custom activity, create an Empty SharePoint 2013 project and select the deployment as sandbox solution.
Add a new Item, select Workflow Custom Activity:
Then you will need to create your Workflow Activity actions, use the ToolBox and drag the actions you need.
In my case, I used the “LookupSPPricipal”, that receives a UserLoginName, and will get that user’s information from Sharepoint. The UserLoginName is defined as an input argument to my WF Activity. The output of this action will go to a local variable named “User”.
I used another action “GetDynamicValueProperties” to get the User’s Display Name. This action receives the object “User” and the output goes to an output argument “DisplayName”
We need to configure the output and input parameters in the file “.actions4”.
After that, I deployed my WF and opened SharepointDesigner. I could see my new Activity:
I created a test Site Workflow that calls my Custom Activity, and logs to history list the output “Display Name”:
I published my WF and run it: