This blog post will provide instructions on retrieving or removing the metadata of an Option Set or Multi-Select Option Set using the Web API.
In MSCRM, the String Map table can be utilized to retrieve details regarding option sets. This table is primarily utilized to store information related to option set fields that exist within the organization. It contains all pertinent data regarding the option set, such as the attribute name, option set name, option value, option name, and object type code.
Consider the following example where we will retrieve the metadata of the ‘industrycode‘ attribute from the ‘account‘ table.
Get Request :
https://younggod.api.crm.dynamics.com/api/data/v9.1/stringmaps?$select=value,attributevalue,displayorder&$filter=objecttypecode eq 'account' and attributename eq 'industrycode'&$orderby=displayorder asc&$count=true
Here, we will remove the option name ‘Accounting‘ from the ‘industrycode‘ attribute on the ‘account‘ table.
Get Request :
https://younggod.api.crm.dynamics.com/api/data/v9.1/stringmaps?$select=value,attributevalue,displayorder&$filter=objecttypecode eq 'account' and attributename eq 'industrycode' and attributevalue ne 1&$orderby=displayorder asc&$count=true
Happy D365ing.
Related blog links of Web API:
Set up a Postman Environment and Application User for Dynamics 365 CE – Nebulaa IT Solutions,
Filter in expand query of OData (D365 CE) – Nebulaa IT Solutions,
Batch Request to Create, Update and Delete records in Dynamics 365 CE – Nebulaa IT Solutions,
Create Notes with Attachment using Web API in Dynamics 365 – Nebulaa IT Solutions,
Create Parent – Child Record in Single D365 Web API Request – Nebulaa IT Solutions,
Use postman to Create record in Dynamics with the Web API – Nebulaa IT Solutions