Skip to content

Instantly share code, notes, and snippets.

@NickPl
Created January 28, 2018 22:39
Show Gist options
  • Save NickPl/7a5071f53faf14bc9324f65bf436c6c9 to your computer and use it in GitHub Desktop.
Save NickPl/7a5071f53faf14bc9324f65bf436c6c9 to your computer and use it in GitHub Desktop.
Blog XrmMtl - CRM 2016 – Update lookup field bug
//Create the lookup value object
var lookupReference = [];
lookupReference[0] = {};
lookupReference[0].id = “{a0c68c89-9752-e311-93f9-00155d78043f}”;
lookupReference[0].entityType = “new_entityname”;
lookupReference[0].name = “Display name”;
//Magic happens here
lookupReference[0].type = “lookup”;
//Update the lookup field
Xrm.Page.getAttribute(“new_entitynameid”).setValue(lookupReference);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment