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

One thought on “How to add new option set value in global option set using webapi in Dynamics 365 ce

Add yours

Leave a comment

Blog at WordPress.com.

Up ↑