Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 82002

How to set 'Unit' on Quote product to a default value CRM 2011

$
0
0

I am trying to default the field Unit to the Lookup value of 'KG' on Quote Products. I have tried the following 2 methods and neither seem to work. Could someone please advise.

Method 1:

function SetDefaultUnit() {
//Create an array to set as the DataValue for the lookup control.
var lookupData1 = new Array();
//Create an Object add to the array.
var lookupItem1= new Object();
//Set the id, typename, and name properties to the object.
lookupItem1.id = '{DD0CD04E-6D92-E311-86C4-00505688378E}';
lookupItem1.typename = 'uom';
lookupItem1.name = 'KG';
// Add the object to the array.
lookupData1[0] = lookupItem1;
// Set the value of the lookup field to the value of the array.
crmForm.all.defaultuomid.DataValue = lookupData1
}

Method 2:

if (Xrm.Page.getAttribute("uomid").getValue() == null)
{
var lookupData = new Array();
var lookupItem= new Object();
lookupItem.id = '{DD0CD04E-6D92-E311-86C4-00505688378E}';
lookupItem.entityType = 'uom';
lookupItem.name = 'KG';
// Add the object to the array.
lookupData[0] = lookupItem;
// Set the value of the lookup field to the value of the array.
Xrm.Page.getAttribute("uomid").setValue() =lookupData;
Xrm.Page.getAttribute("uomid").setSubmitMode("always");
alert(lookupData);
}


Viewing all articles
Browse latest Browse all 82002

Latest Images

Trending Articles



Latest Images