Easily Translate CRM Option Values Using KingswaySoft

31 July 2024
KingswaySoft Team

When working with Dynamics 365 CE/CRM entities, there are special types of fields that may require additional attention while writing to them. An important example from these is the Option type field. An Option or Option Value field is a type of field that defines a set of options or choices to pick from. When such fields are created and displayed in a form, it uses a drop-down list control from where you can choose the value you require. Other common terminologies for these fields are picklist, option set, choice, etc. In this blog post, we shall refer to them as "Option" fields.

Now, while having to write to such fields in your Dynamics 365 CE/CRM instance, you may face a challenge if your data source and destination have a different set of values. For example, let's assume that the acceptable values for an Option field in your Destination instance are "A", "B", and "C"; however, in your Source, the same field has the values "1", "2", and "3", respectively for each record, where 1 corresponds to A, 2 to B, and 3 to C. This would create an issue when the field from the Source is mapped to the Destination, and you would end up getting an error at runtime, stating that the input values do not fall in the range of the options specified. This is expected, as the values that flow in the Source records are not what the Option field in the Destination expects. In such scenarios, you would need to implement a way to perform translations between the Source and the Destination component as part of your ETL transformation. But that would add complexity to the data flow, and would become an extra configuration or flow you would need to maintain and update as required.

This is where KingswaySoft's Option Value Mapping functionality comes in handy. In our latest release (v24.1), we have introduced this feature as a part of our CE/CRM Destination component, where you can directly configure the translations within the component, thereby reducing any overheads in the design. In this blog post, we will be going through an example demonstrating how to work efficiently with this new feature.

Defining an Option/OptionSet field.

In your CRM UI, you will find fields that have a set, or a finite set, of values to choose from. These are not static text fields where you can enter any value, instead, the value needs to be chosen from the available options. This is primarily what Option type fields are. Please find an example in the CRM Account creation form below.

CRM UI Options.png

In the above example, the Contact Method field can be set from any of the values that come from the drop-down list. If you wish to create or modify an Option field, you could navigate to Settings > Customization, and choose the entity. As you can see in the image below, this is the customization page for the Contact Method field, which has the name Preferred Method of Contact, and the datatype is set to OptionSet. The Option values are listed at the bottom, and you can see that one among those is also chosen as the default value - "Any".

Option field customization.png

If you wish to add any values, you could use the "+" icon on the customization page. You can also delete or modify any of the values by clicking on the appropriate ones.

Configuring Option Value Mapping in CRM Destination Component

When you map the input field to Option field in the CRM Destination component, the column that shows "Option Value Mapping" displays an ellipsis button. 

Column Mapping.png

When you click it, it opens the option Value Mapping editor window, where you can see that the Target Option Value has the list of available values for that specific field that we have chosen.

OptionValueMapping.png

Let's assume that our Source data has A, E, F, M, and P, respectively for Any, Email, Fax, Mail, and Phone. We could configure the editor to perform the translations at runtime as shown below.

OptionValueMappingConfigured.png

Now, the above should work seamlessly when all the input values correspond to what we have set in the translation table. However, when there is an unmatched value, this would need to be handled as well. The Option Value Mapping feature provides an option for this too, by using any of the options available in the Handling of non-matched values. Here, you can choose between five options as shown below. For more details on this, please refer to our Online Help Manual.

OptionValueMappingNonMatched.png

For our specific use case, we are choosing the "Replace as an existing Option" option and selecting the value "Any", as that is the default type based on the field customization.

ChooseAny.png

With this setup, at runtime, you should see that when the records are being written to the CRM instance, the Preferred Contact Method field will be set according to the translations we have defined for any matching values. For records with non-matched values as input, the default value "Any" would be set for that field. The image below shows the data flow at runtime, and as you can see, the ContactMethod values are flowing from the Source, and the Destination component translates and writes them successfully.

Data Flow Execution.png

Conclusion

Based on what we have gone through, you can see how easily Option Value translations can be handled within the CRM Destination component. This decreases the complexity of your design, removes the need for adding separate transformations in the flow, and makes it easy to handle non-matched values.

We hope this has helped!

Archive

December 2024 1 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