There are scenarios where you need to access data from an entity that is not directly related to the entity for which you are building a Workflow in Dynamics 365.
For example, you want to send an email alert to the Owner of the Account on the Opportunity when an Opportunity Line is created or updated with the amount exceeding $10,000. In this case, the Workflow will be created for the Opportunity Line entity which triggers the Workflow. However, within the Workflow Designer, you can access data only from the entities that are reated to Opportunity Line entity such as Opportunity or Product. However, Account is not directly related to the Opportunity Line entity and therefore you cannot access the Owner field of the Account within the Workflow. To get around this limitation, you can create another Process of type Action. The Action will be for the Account entity and it will return the Entity Reference for the Account being passed to the Action. You can then call (perform) this Action within your Workflow. This will enable you to access any fields from the Account entity within the Workflow. Here are the specific steps to implement this solution.
For example, you want to send an email alert to the Owner of the Account on the Opportunity when an Opportunity Line is created or updated with the amount exceeding $10,000. In this case, the Workflow will be created for the Opportunity Line entity which triggers the Workflow. However, within the Workflow Designer, you can access data only from the entities that are reated to Opportunity Line entity such as Opportunity or Product. However, Account is not directly related to the Opportunity Line entity and therefore you cannot access the Owner field of the Account within the Workflow. To get around this limitation, you can create another Process of type Action. The Action will be for the Account entity and it will return the Entity Reference for the Account being passed to the Action. You can then call (perform) this Action within your Workflow. This will enable you to access any fields from the Account entity within the Workflow. Here are the specific steps to implement this solution.
Create a Process of type Action on the Account entity.
Add an Argument of Type EntityReference returning the Account entity as Output.
Add the Assign Value step as shown in the screenshot below.
Activate the Action.
Next, create a Workflow for the Opportunity Line entity.
Select "Record is created" and "Record fields change" (Line Amount) triggers.
Add condition. In this case it is: if Opportunity Line:Amount > 10,000.
Add the Perform Action step and select the Action created above.
Pass the Account on the Opportunity as the Input parameter.
Add the Send Email step.
As you can see from the screenshot below, you can now access the Owner field on the Account to populate the “To” (email recipient) in the Send Email step.
As you can see from the screenshot below, you can now access the Owner field on the Account to populate the “To” (email recipient) in the Send Email step.
Complete the other details for your email.
Activate the Workflow and test your Workflow by adding or updating a line on the Opportunity exceeding $10,000.
You can use this Action in other Workflows or code where you need to retrieve data from a specific Account record.
In addition, you can use this technique to update an unrelated record in your Workflow which was not previously possible.
You can also use this technique to retrieve data from the Business Unit of the record owner
or Field Service Settings which are not directly related to the record on which the Workflow is being executed.
In this post, we saw how you can retrieve or update data in an unrelated entity within the Workflow using Action.
In addition, you can use this technique to update an unrelated record in your Workflow which was not previously possible.
You can also use this technique to retrieve data from the Business Unit of the record owner
or Field Service Settings which are not directly related to the record on which the Workflow is being executed.
In this post, we saw how you can retrieve or update data in an unrelated entity within the Workflow using Action.
5 comments:
Hey there doesn't seem to be an option in dynamics to select the action from an unrelated entity. I am trying to get tasks in a similar way to what you doing here. But this doesn't seem to be allowable.
@Edson Santos
This technique can be used if the entity is related with N:1 relationship type and not 1:N relationship type. You may want to look into the following tool on github: https://github.com/demianrasko/Dynamics-365-Workflow-Tools
This will enable you to update child records and trigger another Workflow.
Abi,
When I try to consume the result that was returned from the Action I keep getting the following error:
"Required Target Field is missing".
did you encounter this?
Michael, I did not encounter this. Please review the following step in the post: Pass the Account on the Opportunity as the Input parameter
If this does not help, please send me the relevant screenshots so that I can review them.
You will need to ensure the Action is based on the Account entity to be able to access the Target parameter.
Post a Comment