USING CRM ACTIONS TO OVERCOME WORKFLOW LIMITATION OF ACCESS TO MAIN OR RELATED ENTITIES

Limitation:
One of the workflow limitations is; it does not support access to its next related entity. One can only access the main entity or the related entities but not next related entity.

Example:
we have 3 entities Account, Contact and CustomEntityA.
Account is related to Contact and Contact is related to CustomEntityA. Account is not directly related to CustomEntityA.

If we want to update a field e.g. description on CustomEntityA on update of the description of Account, or if we want to update Account’s description from CustomEntityA’s description, we cannot do it with OOB workflow. We can either write plugin/customWorkflowActivity or there is another option without coding anything which is combination of Action and Workflow.

Bellow is an example of how to access next related entity using custom action and workflow.

  1. Create a crm process of type Action with two input parameters of entityreference type for those entities that are not directly related e.g. Account and CustomEntityA. Include necessary steps as required by business logic. Her is an example of such Action process:In the example below our CustomEntityA is AccContactDesc and we will be updating its description from the description of account as soon the account description changes.
    Here is the screenshot of worflow of type Action

    Properties of update step:

  2. Create a process of type workflow and call Action process(created in Step.1 ) passing parameter.
    Properties of calling action in workflow.

    Here are the results: after updating the account’s description the workflow updates the description of AccContactDesc which is related to this account’s primary contact.

    As we can see our custom entity AccContactDesc is not directly related to account but next-related through Account’s primary contact. We can still access it using combination of workflow and actions.