0

I have a task to fulfill package.xml file with new developed workflow. This workflow contains time trigger which send an email alert to recipient after some time of inactivity. As a metadata type, it's in the documentation described here, but I couldn't find any mentions about how it should look in the package.xml file; seems like it shouldn't even be there...

Example from workflow file:

    <workflowTimeTriggers>
        <actions>
            <name>Some_name_of_alert</name>
            <type>Alert</type>
        </actions>
        <offsetFromField>Lead.CreatedDate</offsetFromField>
        <timeLength>24</timeLength>
        <workflowTimeTriggerUnit>Hours</workflowTimeTriggerUnit>
    </workflowTimeTriggers>

Any ideas?

Thanks

1 Answer 1

0

Workflow metadata contains many sub-components:

  • WorkflowAlert
  • WorkflowFieldUpdate
  • WorkflowKnowledgePublish
  • WorkflowOutboundMessage
  • WorkflowRule
  • WorkflowTask

It's generally easier to deploy the Workflow metadata for the given object to make sure all dependent metadata is included rather than specify per each specific sub-component. Be aware this will deploy all related workflow metadata for that given object

<?xml version="1.0" encoding="UTF-8" standalone="true"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>YourObjectName</members>
        <name>Workflow</name>
    </types>
<version>52.0</version>
</Package>

If, for whatever reason, you did want to deploy pieces: you'll see that WorkflowTimeTriggers is within the WorkflowRule type. You didn't share your full workflow metadata file, but it's surrounded by <rule>

<rules>
    <fullName>RuleName</fullName>
    <actions>
        <name>ActionName</name>
        <type>FieldUpdate</type>
    </actions>
    <active>true</active>
    <criteriaItems>
        ...
    </criteriaItems>
    <triggerType>onCreateOrTriggeringUpdate</triggerType>
    <workflowTimeTriggers>
        <actions>
            <name>TimeTriggerFieldUpdateName</name>
            <type>FieldUpdate</type>
        </actions>
        <timeLength>30</timeLength>
        <workflowTimeTriggerUnit>Days</workflowTimeTriggerUnit>
    </workflowTimeTriggers>
</rules>

You can specify the rule by its name, but you also have to make sure to specify any related field update/email alert/outbound message/task used within the time based action separately. Below is an example of time-based trigger with a field update

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>YourObject.RuleName</members>
        <name>WorkflowRule</name>
    </types>
    <types>
        <members>YourObject.FieldUpdateName1</members>
        <members>YourObject.FieldUpdateName2</members>
        <name>WorkflowFieldUpdate</name>
    </types>
    <version>52.0</version>
</Package>

1
  • Thanks for answer Kris, I understand that we don't have this particular MD type and it shouldn't be separated from workflow or it's rule, because it's actually the option of some kind of process.
    – Alex T
    Commented Sep 16, 2021 at 14:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .