Search code examples
dynamics-crmmicrosoft-dynamicsdynamics-365

How can I get 'which updated fields can trigger to Dynamics CRM workflow'?


I have a custom workflow activity. The workflow has been triggered by one of 10 specific fields updated.

I need these 10 fields what are they in my custom workflow. Is there any way I can get this information in custom workflow?

enter image description here

Edited After Aron's comment:

I try Aron's solution. It works, but some fields are missing.

For example, I have 7 fields (include the address field) to trigger my workflow as below.

enter image description here

enter image description here

But TriggerOnUpdateAttributeList has only 4 fields as below.


Solution

  • The Workflow entity has a field called TriggerOnUpdateAttributeList which contains what you're looking for.

    One way to access it would be a FetchXML query:

    <fetch top="1" >
        <entity name="workflow" >
            <attribute name="name" />
            <attribute name="primaryentity" />
            <attribute name="triggeronupdateattributelist" />
            <filter>
                <condition attribute="name" operator="eq" value="My Workflow" />
                <condition attribute="triggeronupdateattributelist" operator="not-null" />
            </filter>
        </entity>
    </fetch>
    

    In the result, the TriggerOnUpdateAttributeList contains a comma separated list of the logical names of the fields:

    <result>
        <name>My Workflow</name>
        <primaryentity name="" formattedvalue="2">2</primaryentity>
        <triggeronupdateattributelist>firstname,lastname,parentcustomerid</triggeronupdateattributelist>
    </result>