JavaScript – Set Activity Party

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);

};

3 thoughts on “JavaScript – Set Activity Party

  1. Pingback: JavaScript – Get Activity Party List | Microsoft Dynamics CRM and Unified Service Desk

  2. Pingback: JavaScript – Get Activity Party List - Microsoft Dynamics CRM Community

  3. Pingback: Happy New Year – Pop Pickers | Microsoft Dynamics CRM and Unified Service Desk

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s