Skip to content

Instantly share code, notes, and snippets.

@DynCon365
Last active April 24, 2018 16:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DynCon365/bcdcaba61bd6051116eed7bcb7a4c11f to your computer and use it in GitHub Desktop.
Save DynCon365/bcdcaba61bd6051116eed7bcb7a4c11f to your computer and use it in GitHub Desktop.
Dynamics 365/CRM | Set the value of an Option Set
// Set the value of the Opportunity Status Reason field
// Note: Option Set fields are set based on the database id, rather than the name
Xrm.Page.data.entity.attributes.get("statuscode").setValue(100000001);
// Set the value of the Opportunity Status Reason field to a variable
var statusReasonId = 100000001;
Xrm.Page.data.entity.attributes.get("statuscode").setValue(statusReasonId);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment