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.