This post is a contribution from Raghavendra B Nanjaiah, an engineer with the SharePoint Developer Support team.
First part is to create our code activity and let the Workflow Manager and SharePoint 2013 know about it.
1. In VS 2012, click New Project, Workflow and choose Activity Library.
2. Delete the declarative Activity1.xaml from the solution since we will be creating our own custom code activity.
3. In solution explorer on newly created activity library right click and select add new item -> Workflow -> Code Activity.
4. Decide what data you would like to pass in to custom activity. In my case I am accepting string as InArgument and trying to create new list item based on the input string parameter (you can also use OutArgument which represents the flow of data out of an activity).
5. Write your activity logic in overridden execute method.
6. Build the Project and sign the code activity assembly.
7. Now, Create a new xml file and name it as AllowedTypes.xml and add the reference of you activity library dll , Namespace and type as shown below ( this basically adds your assembly to whitelist which Workflow service trust and loads. If your assembly is not in whitelist you might receive activity not found exception)
8. Now it's time to deploy our assembly and allowedtypes.xml to the folder from where Workflow manager and SharePoint can read.
* On the Workflow Manager box you have to:
- Copy activity assembly to following locations:
> %ProgramFiles%\Workflow Manager\1.0\Workflow\Artifacts
> %ProgramFiles%\Workflow Manager\1.0\Workflow\WFWebRoot\bin
- Add your activity class to the white-list
> Copy AllowedTypes.xml also to above two locations
- Restart “Workflow Manager backend” service
* On SharePoint box you have to:
- Copy activity assembly to SharePoint box and install it in the GAC.
- Reset IIS
Now, the second part is to create a workflow using custom code activity that we created by following the above steps.
1. Now in the same visual studio solution where you have custom code activity add new SharePoint 2013 Workflow project.
2. From the toolbox drag and drop the custom code activity that we just developed.
3. Right click and deploy the solution to your SharePoint site.
Bingo! Now we have developed and deployed custom code activity Workflow in SharePoint 2013 with Workflow Manager 1.0.
Hope this helps!
I think it is a better idea to implement custom code as webservice instead of a custom activity. This method is fully supported in deployment and execution.
I can not find the Sharepoint 2013 Workflow Project Template in either VS 2010 or in VS 2013, can you provide a little more guidance on this?
Please try VS2012!
@dlr442218: Download and install SharePoint 2013 development tools from here: msdn.microsoft.com/.../fp123627.aspx. Click "Download the tools" in the section "Microsoft Office Developer Tools for Visual Studio 2012".
When you establish a new ClientContext, does this run with workflow app-permissions, or as the Workflow Service Account
I have found that i have to give the Workflow service account explicit permissions on the resources needed, to avoid a 401 error when creating a new clientcontext
BigProfitbuzz is an Indian stock market advisory firm. BigProfitbuzz proven month after month that trading and investing in stock market can be profitable whether market is bull or bear. As suggested last week our all client made a very good profit in the buy position of NIFTY. Now for the coming week we suggest all the traders to make a sell position in NIFTY around 6200-6250 with stoploss 6400 for the target of 5900-5800.This is due to that NIFTY is unable to sustain its peak so traders can make a sell position to make some profit. You can also can make sell position in NIFTY stocks also. But keep the strict stoploss of 6400 for the NIFTY & NIFTY stocks. For further update visit our website.
The steps for writing .actions4 file are missing.
Beware that this will not work in SharePoint Online