top of page
  • Writer's pictureYash Agarwal

Add new values to CDS Option Sets using Power Automate

In this #PowerShot, I will show you how you can add a new option to a CDS option set. We will use the Common Data Service (Current Environment) connector and the Perform Unbound action to achieve this.


Let's Get Started!


Option sets in Common Data Service are a widely used data type and the *only* way to add more options to an option set is by navigating to the solution and then to the option set and then adding the options manually. Now in this post, we will use a flow to create options in an option set using the "InsertOptionValue" unbound action. More information on this action can be found here. We are going to use the common data service (current environment) connector and more information on this connector can be found here.

 

Common Data Service


I have an option set already created in a solution in CDS as shown in the screenshot below:

Currently, it has 5 options for a user to select from. Using the flow setup, we will add more options to this option set and automate the manual process of creating the options in the option set.

 

Power Automate


Step 1: Trigger- Manual: To manually trigger the flow and provide the input for the option that needs to be added to the option set.

Step 2: Action- Perform an unbound action using the Common Data Service (current environment) connector. Select the action name as 'InsertOptionValue'. Provide the logical names for the option set name from CDS. In the Label attribute, use JSON Payload (sample):


{

"LocalizedLabels": [

{

"Label": "@{triggerBody()['text']}",

"LanguageCode": 1033,

"IsManaged": false,

"HasChanged": null

}

],

"UserLocalizedLabel": {

"Label": "@{triggerBody()['text']}",

"LanguageCode": 1033,

"IsManaged": false,

"HasChanged": null

}

}


Provide the name of the solution and save the flow.

 

Setup in Action

 

In this post, we saw how to add a value to an option set in CDS using Power Automate using the perform unbound action from the Common Data Service (Current Environment) connector. The same action can be used for a lot of functionalities available as unbound actions including removing an option from the option set.


I hope you found this interesting and it helped you. Thank you for reading.

Recent Posts

See All
bottom of page