Basics: Partylist
Get Partylist value
var vTo = crmForm.all.to[0];
var lookupItem = new Array;
lookupItem = null;
lookupItem = crmForm.all.to.DataValue;
// The text value of the lookup.
alert(lookupItem[0].name);
// The GUID of the lookup.
alert(lookupItem[0].id);
// The entity type name.
alert(lookupItem[0].typename);
Set Partylist value (to regarding value - only when regarding != null and regarding contact)
if (crmForm.all.regardingobjectid.DataValue !=null)
{
var lookupItem = new Array;
lookupItem = null;
lookupItem = crmForm.all.regardingobjectid.DataValue;
if (lookupItem[0].type == 2) // contact
{
to_lookupItem = crmForm.all.regardingobjectid.DataValue;
var lookupData = new Array();
var lookupItem= new Object();
//Set the id, typename, and name properties to the object.
lookupItem.id = to_lookupItem[0].id;
lookupItem.typename = to_lookupItem[0].typename;
lookupItem.name = to_lookupItem[0].name;
lookupItem.type = to_lookupItem[0].type;
// Add the object to the array.
lookupData[0] = lookupItem;
crmForm.all.to.DataValue = lookupData;
}
}
var vTo = crmForm.all.to[0];
var lookupItem = new Array;
lookupItem = null;
lookupItem = crmForm.all.to.DataValue;
// The text value of the lookup.
alert(lookupItem[0].name);
// The GUID of the lookup.
alert(lookupItem[0].id);
// The entity type name.
alert(lookupItem[0].typename);
Set Partylist value (to regarding value - only when regarding != null and regarding contact)
if (crmForm.all.regardingobjectid.DataValue !=null)
{
var lookupItem = new Array;
lookupItem = null;
lookupItem = crmForm.all.regardingobjectid.DataValue;
if (lookupItem[0].type == 2) // contact
{
to_lookupItem = crmForm.all.regardingobjectid.DataValue;
var lookupData = new Array();
var lookupItem= new Object();
//Set the id, typename, and name properties to the object.
lookupItem.id = to_lookupItem[0].id;
lookupItem.typename = to_lookupItem[0].typename;
lookupItem.name = to_lookupItem[0].name;
lookupItem.type = to_lookupItem[0].type;
// Add the object to the array.
lookupData[0] = lookupItem;
crmForm.all.to.DataValue = lookupData;
}
}

0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home