cancel
Showing results for 
Search instead for 
Did you mean: 

WCM workflow transformation

tfrith
Champ on-the-rise
Champ on-the-rise
I'm using Alfresco Ent 2.2.1.

I've got a new workflow deployed and am working on modifying it to transform MS Word form attachments to PDF.

Can anyone give me an example (java handler or javascript) of how to reference the attachment from within the workflow so that I can call the transformer?  I think I know how to do the transformation but I just don't know how to get at the attached MS Word doc.

Thanks,
Tim
1 REPLY 1

pmonks
Star Contributor
Star Contributor
In WCM, each workflow has a dedicated sandbox associated with it (called, unsurprisingly, a workflow sandbox) that contains the change set that's being run through the workflow.  You can get the store id for this sandbox via the workflowPackage attribute of the WorkflowInstance object (http://dev.alfresco.com/resource/docs/java/repository/org/alfresco/service/cmr/workflow/WorkflowInst...).  Once you have that you can use the AVMSyncService (http://dev.alfresco.com/resource/docs/java/repository/org/alfresco/service/cmr/avmsync/AVMSyncServic...) to calculate what's unique to the workflow sandbox (ie. to identify the change set) and then the AVMService (http://dev.alfresco.com/resource/docs/java/repository/org/alfresco/service/cmr/avm/AVMService.html) to access that content and write additional assets back into the workflow sandbox.

I don't recall off the top of my head if the WorkflowInstance object is provided by default to custom workflow tasks, but you can retrieve it easily enough via the WorkflowService (http://dev.alfresco.com/resource/docs/java/repository/org/alfresco/service/cmr/workflow/WorkflowServ...).

One word of warning: generating assets during workflow may create in-context preview problems for your content contributors, since the derived assets won't exist in the contributor's user sandbox.

Cheers,
Peter