Monday, 21 July 2008

Copy the lookup fields values from one to another look field

Hi Friends,

Below is the code to copy the value of a look up field to another lookup field.

For example, on contracts, if you have to copy the value of the customer field to Bill to Customer field.

//Get the value of the custom customer field on the form
var vendor = crmForm.all.new_vendorsid.DataValue;

if (vendor != null)
var lookupData = new Array();
var lookupItem= new Object(); = vendor[0].id;
lookupItem.typename = vendor[0].typename; = vendor[0].name;

lookupData[0] = lookupItem;
//Set the value of another custom lookup field on the form
crmForm.all.new_billtovendorid.DataValue = lookupData;

No comments: