Software Technology Tips

PartyList : This is a  data type available in MS crm.
It  is almost  a lookup  that can have references to more than one records of an entity for a single field.
A partylist  has certain attributes like   name, id, type,typename etc.
 
So the basic operation  for such a field will be to retrieve or set the values.
As partylist  is not a normal type like integer or string type we need to  have arrays to get/set the values.
To retrieve values by jscript:
 
var partylistItem = new Array;
 
//get the items/values in a field named"resources"
partylistItem  = Xrm.Page.getAttribute("resources").getValue();
 
Thus now the array  holds all the items/record  referenced for a single field
 
.
we may  have a  loop through this array  to retrieve the values like,
 

partylistItem.length - gives how many records are referenced.

partylistItem[0].id - the guid of the item.

To set values by  jscript :

To set  values we also  need to  get an  array.

var partlistset= new Array();
partlistset[0] = new Object();
partlistset[0].id = id; // provide a guid type value
partlistset[0].name = name; // provide a suitable name
partlistset[0].entityType = entityType; // provide the entity  name  of the item  ie account/ contact etc .
Xrm.Page.getAttribute("resource").setValue(partlistset);
 


Related Tags:

MS CMS CM 2011

Author: Pallavi Kar

MS CRM

Let us Connect!

iso 9001 QA25 Red Herring STPI D&B Fastest Growing SME 2013 Award zinnov Nasscom

copyright (c) Mindfire Solutions 2007-2014. Login