How to add new option set value in global option set using webapi in Dynamics 365 ce

I was trying to found out how we can add a new value to a global option set and below post request can do the same :

https://vgrade2.api.crm8.dynamics.com/api/data/v9.1/InsertOptionValue

{
  "OptionSetName": "new_test",
  "Label": {
      "LocalizedLabels": [
          {
              "Label": "anewoptionsetlabel",
              "LanguageCode": 1033
          }
      ]
  }
}

Output:

{
    "@odata.context": "https://vgrade2.api.crm8.dynamics.com/api/data/v9.1/$metadata#Microsoft.Dynamics.CRM.InsertOptionValueResponse",
    "NewOptionValue": 100000005
}

Untitled.png

Be default it put the new option set in alphabetic order so you might want to add it in the end.

Ref: https://docs.microsoft.com/en-us/dynamics365/customer-engagement/web-api/insertoptionvalue?view=dynamics-ce-odata-9

Thanks

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Blog at WordPress.com.

Up ↑

%d bloggers like this: