Following on from an earlier post that explained how to set an activity party list, here is some JavaScript to show how to get an activity party list.

getParty("to");



function getParty(fieldName) {

  var party = Xrm.Page.getAttribute(fieldName);
  var members = party.getValue();

  for (var i = 0; i < members.length; i++) {
	// Contact
	if (members[i].type == 2) {
	  alert("Contact Id-" + members[i].id + " Name-" + members[i].name);
	}
	// Account
	if (members[i].type == 1) {
   	  alert("Account Id-" + members[i].id + " Name-" + members[i].name);
	}
	// Lead
	if (members[i].type == 4) {
	  alert("Lead Id-" + members[i].id + " Name-" + members[i].name);
	}
	// User
	if (members[i].type == 8) {
	  alert("User Id-" + members[i].id + " Name-" + members[i].name);
	}

  }

}