I seem to have a theme of JavaScript posts this week! Maybe because I’m having “fun” doing some coding ….. anyway here is a simple snippet you might find useful.
This function can be used to set an activity party field. Such as “to” or “from” on a phone call. Simply pass in the field you want to set. Say “to”. The id and name of the contact (or other entity) you want to assign, plus the entity type. Say “contact”.
// *** Function to set a party list function setToPartyList(fieldName, id, name, entityType) { var party = Xrm.Page.getAttribute(fieldName); // Create new array var partlist = new Array(); partlist[0] = new Object(); partlist[0].id = id; partlist[0].name = name; partlist[0].entityType = entityType; // Set array value party.setValue(partlist); };
Pingback: JavaScript – Get Activity Party List | Microsoft Dynamics CRM and Unified Service Desk
Pingback: JavaScript – Get Activity Party List - Microsoft Dynamics CRM Community
Pingback: Happy New Year – Pop Pickers | Microsoft Dynamics CRM and Unified Service Desk
Hi Neil, i am setting custom entity vendor in to party list but it give me error vendor entity not supported.
if i set lead,contact,account,or user entity then it worked but custom entity not supported.
could you please suggest.
LikeLike
You are right the to/from fields using the activity parties entity do only support lead, contact, account or user. You would need to create a custom
many to many relationship.
LikeLike