Working With Dynamics CRM Action Outputs Using KingswaySoft

30 August 2024
KingswaySoft Team

In integration scenarios, Dynamics CRM actions, plugins, and workflows are some of the extension points that can be used to augment system behaviors for great flexibility. Actions, in particular, provide the ability to perform logical operations and return a set of values as its output, which, if used within our SSIS data flow design, would be beneficial. Using the recent versions of our SSIS Integration Toolkit for Dynamics 365, you can easily handle these output values and use them in your SSIS data flow process.

Actions in Dynamics 365 CE/CRM instances are defined as processes that can be triggered by a specific application, code, or another process. These have the ability to implement business or operational logic, such as checking for a set of conditions, assigning values based on those conditions, sending emails, checking another condition, and more. An action can take inputs, either as external arguments or from within an entity, and produce output parameters that can be used to produce output values as a result of the Action. Now, when you create an action, it gives you the flexibility to configure the various steps involved. For example, if you wish to verify whether an Account satisfies certain conditions, and if it does, then proceed to perform some steps, or if not, then proceed with another set of steps—these types of conditional branching and decisions can be easily automated by using Actions and its properties. An Action can be created either linked to an entity, deriving the fields from the entity itself along with input arguments, or as a global action, not tied to an entity, and working solely based on the input arguments.

When working with KingswaySoft Dynamics CRM components, we provide an option called ExecuteWorkflowAction in the CRM Destination component, which you can use to execute a workflow or an Action. On the general page, you can choose the Action discovered from a list of available processes, and on the Columns page, you can provide the Input parameters or arguments, if any. Additionally, in our recent versions (Since v23.1), you can also get the output arguments as a part of the Default output, giving you the ability to use the output for further data flow logic and design.

In this blog post, we will be demonstrating how to configure an action, trigger it using the KingswaySoft CRM Destination component, and capture the output for further processing. 

Creating an Action within Dynamics 365 CRM Instance

First, we will create an action in the CRM instance. For this, we need to navigate to the Advanced Settings and choose Processes from under Process Center. Here, click on New to open up the CreateProcess window.

New Process.png

Create New process.png

Here, provide the Process Name, and select the category as Action. You could leave the Entity blank if you do not wish to tie it to any specific entity. In our case, we are selecting the Account entity. For Type, since we are going to create the steps from scratch, we will choose New blank process. Click on OK, which will open a new window to enter the general properties associated with the Action. 

ActionDefinition.png

Once here, create an Argument called PreferredCustomer, set the datatype as boolean, and the Direction as Output. This is what we will be using to read back the result of our Action within our SSIS design. We do not need Input Arguments, as our conditions will be based on Account entity fields. We will see how this is done in the upcoming section. Now, we need to create steps to perform the Action. Our use case is as follows:

Check to see if the specific Account (which is identified by using the AccountId) has a Credit Hold or not. If it does, then the Account is not a preferred customer, and we would set the output argument PreferredCustomer to False. Otherwise, if there is no Credit Hold, then we check to see if the Credit Limit exceeds a certain amount along with the Relationship Type. If it passes the conditions, then set the PreferredCustomer output to True. 

For the above use case, we would create the Action steps as shown below by clicking the Add Step button and by branching conditionally.

ActionConditions.png

When you set properties for the steps, the window below is what you would use to choose either the arguments or the entity metadata fields. In our case, as mentioned earlier, we will use the entity fields. The AccountId to be validated against will be provided in our SSIS design, and we will see how that is done in the next section.

CreateConditions.png

Once configured, let's save and close the Action. Then, we Activate it. 

ActivateAction.png

Next, we move to the SSIS package to configure the CRM/CDS Destination component to consume or trigger the action.

Data Flow to Trigger the Action and Capture the Output

In our SSIS data flow, have a Source Component ready with the AccountId, Account Names, etc., that you wish to perform the Action against. Connect it to the CRM Destination component, and on the General page, choose the action as ExecuteWorkflowAction and select account as the destination entity. Now, choose the CheckCustomerStatus Action from the list. If you do not see your Action in the list, please cross-check if the Action is activated and is in the scope of the chosen entity.

CRM Destination Select Action.png

On the Columns page, map the Input Column with the Account details against accountId. In our example, we do not have the AccountId in the Source system; therefore, we pass the Account Name and then perform a Text lookup against it. To know more on how to work with Text lookups, please refer to our Online Help Manual.

CRM Destination Columns Page.png

The AccountId retrieved from the lookup will be used to trigger the CheckCustomerStatus action that we have previously configured. On the Error Handling page, you will see that under Enable Columns for Default Output, the boolean output argument PreferredCustomer is available to be read back. This will hold the boolean value indicating whether the Account we have passed through is a Preferred Customer or not, based on the conditions set in the action.

CRM Destination Action Output.png

Let's run the data flow. As you can see below, we are passing 4 account names to the CRM Destination, which has various CreditHold, CreditLimit and RelationshipType values respectively in the CRM instance. The Action is triggered to check against these, and we receive the boolean output as shown below.

Data Flow Output.png

Conclusion

As seen in our example, using our KingswaySoft Destination component, you can easily trigger an action and parse out the output, making it a very useful functionality for including additional validations or business logic in your SSIS data flow. Leveraging this feature, you can simplify the complexity of your design while at the same time expanding the scope of the package.

We hope this has helped!

Archive

November 2024 3 October 2024 1 September 2024 1 August 2024 2 July 2024 1 June 2024 1 May 2024 1 April 2024 2 March 2024 2 February 2024 2 January 2024 2 December 2023 1 November 2023 1 October 2023 2 August 2023 1 July 2023 2 June 2023 1 May 2023 2 April 2023 1 March 2023 1 February 2023 1 January 2023 2 December 2022 1 November 2022 2 October 2022 2 September 2022 2 August 2022 2 July 2022 3 June 2022 2 May 2022 2 April 2022 3 March 2022 2 February 2022 1 January 2022 2 December 2021 1 October 2021 1 September 2021 2 August 2021 2 July 2021 2 June 2021 1 May 2021 1 April 2021 2 March 2021 2 February 2021 2 January 2021 2 December 2020 2 November 2020 4 October 2020 1 September 2020 3 August 2020 2 July 2020 1 June 2020 2 May 2020 1 April 2020 1 March 2020 1 February 2020 1 January 2020 1 December 2019 1 November 2019 1 October 2019 1 May 2019 1 February 2019 1 December 2018 2 November 2018 1 October 2018 4 September 2018 1 August 2018 1 July 2018 1 June 2018 3 April 2018 3 March 2018 3 February 2018 3 January 2018 2 December 2017 1 April 2017 1 March 2017 7 December 2016 1 November 2016 2 October 2016 1 September 2016 4 August 2016 1 June 2016 1 May 2016 3 April 2016 1 August 2015 1 April 2015 10 August 2014 1 July 2014 1 June 2014 2 May 2014 2 February 2014 1 January 2014 2 October 2013 1 September 2013 2 August 2013 2 June 2013 5 May 2013 2 March 2013 1 February 2013 1 January 2013 1 December 2012 2 November 2012 2 September 2012 2 July 2012 1 May 2012 3 April 2012 2 March 2012 2 January 2012 1

Tags