One of the common PXM requests is the ability to initiate operations on the Sitecore server from within the InDesign client. This would commonly do things such as initiating a workflow or a new version on a content item while within InDesign.
There are two ways in order to accomplish this;
Tasks have the advantage of being able to pass an alert back to the InDesign client. However they have to be initiated manually, often in conjunction with having to select the item in which you want to initiate the task on.
Creating a task is very much like creating a custom renderer. You need to create the code, reference the code and finally define how that reference will appear within the InDesign client interface.
This is very minimal code, the purpose of which is merely to alert back to InDesign a list of variables that are passed to the task. As well, in this case it increments the version of the item that was selected.
" key: "
+ k.Key +
" value: "
+ k.Value +
itemid = dictionary[
Item contentItem = Sitecore.Context.Database.GetItem(itemid);
In the case above, you can see that we are using the item that was selected by the user in the content browser and are executing the action on that item. There are a few variables you can access;
At the /sitecore/Print Studio/Libraries/Tasks library item, choose Insert > Task and correctly name your Assembly, TypeName and MethodName as per your code and project
Tasks are also documented for the end user on the Sitecore Developer Network here in an older version (https://sdn.sitecore.net/upload/sdn5/products/aps/11/indesign%20connector%20user%20manual.pdf ) . Although they are not deprecated, the functionality has been removed from the documentation. However, given the demand for this functionality, I thought it was worth resurrecting it.
Working with the item:save trigger has the advantage in that it can work seamlessly in the background of the save event, and can act upon multiple items. However working with the item:save event is tricky business, and a poorly coded trigger will affect performance for all Sitecore save operations. Also this method does not initiate feedback to the InDesign client.
Rather than replicating the code in its entirety, I will merely link to a blog posting from Dan Sinclair at Sitecore partner Horizontal Integrations.