How to package a single workflow using Force.com Migration tool?

January 26, 2012

Extracting a single workflow out of force.com can be a little tricky. I am using ANT/JAVA migration tool to extract force.com metadata. From the documentation it is clear that 'Workflow' tag should be used to extract workflow.


<types><members>*</members><name>Workflow</name></types>

The above component in project manifest - package.xml will fetch all the workflows related to Opportunity. How to fetch a specific workflow? dot operator will not work in this case. One way to get around this limitation is specifying the following components related to a workflow as appropriate.
  • WorkflowAlert
  • WorkflowFieldUpdate
  • WorkflowOutboundMessage
  • WorkflowRule
  • WorkflowTask
For example, a workflow sends an email and does a field update upon meeting a certain criterion. In package.xml, the following components should be included. 

<types>
<members>Opportunity.Set_Date</members><name>WorkflowFieldUpdate</name></types><types><members>Opportunity.Request Email</members><name>WorkflowRule</name>
</types> <types> 
<members>Opportunity.Send_Email</members<name>WorkflowAlert</name></types>

Make sure we don't miss any alert, field update, task or outbound message coupled with a rule. Upon packaging, we get the right metadata. And, upon deployment we see the workflow in the target environment. 

You Might Also Like

2 comments

  1. Awesome... was looking for something like this....

    ReplyDelete
  2. Hi, how do I package and then retrieve for app visibility and tab visibility for *all* profiles in our org? thanks.

    ReplyDelete

Popular Posts

Twitter