简体   繁体   中英

Use JScript to insert Price List on Quote onOpen in Microsoft Dynamics CRM 2011

Here is my code, I get an object error onLoad. Please help.

function Setlook()
{

var lookup = new Object();
var lookupValue = new Array();
lookup.id = "7b31D4D998-F124-E111-96C3-1CC1DEEA";
lookup.entityType = 1022;
lookup.name = "Default";
lookupValue[0] = lookup;
Xrm.Page.getAttribute(“pricelevelid”).setValue(lookupValue);

}

The code itself looks correct, but the GUID of the lookup doesn't. It doesn't have the right format nor does it have the right number of characters (32). Fixing that should eliminate the error.

Here is the proper syntax, the important thing is to have the correct .typename

function Setlook()
{


var value = new Array();
value[0] = new Object();
value[0].id = '{31D4D998-F124-E111-96C3-1CC1DEE8EC2D}';
value[0].name = 'Default';
value[0].typename = 'pricelevel';

Xrm.Page.getAttribute("pricelevelid").setValue(value);

}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM