I haven’t had to use this javascript yet but I know I am going to need in the future, so I am going to blog about it so I can find it.
there are quite a few examples of this but this blog post compares it to CRM 4 as well, which is extra useful.
CRM 4
var value = new Array();
value[0] = new Object();
value[0].id = idValue;
value[0].name = textValue;
value[0].typename = typeValue;crmForm.all.fieldName.DataValue = value;
CRM 2011
var value = new Array();
value[0] = new Object();
value[0].id = idValue;
value[0].name = textValue;
value[0].entityType = typeValue;Xrm.Page.getAttribute(“fieldName”).setValue(value);
How about doing it on one line like this instead.
CRM 4
crmForm.all.field.DataValue = [{id: idValue, name: textValue, typename: typeValue}];CRM 2011
Xrm.Page.getAttribute(“fieldName”).setValue( [{id: idValue, name: textValue, entityType: typeValue}]);
if you want some more examples and a discussion this forum discussion is the place to look
This page also had an interesting link to an article
Seven JavaScript Things I Wish I Knew Much Earlier In My Career
which I found interesting because I know very little about Javascript



interactivewebs
July 25, 2011
We blogged this experience here: http://www.interactivewebs.com/blog/index.php/server-tips/microsoft-crm-2011-how-to-configure-ifd-hosted-setup/
Metaphorix
September 21, 2011
it’s very difficult to compare javascript from CRM 4 and CRM 2011. My advice is just to learn how it works in CRM 2011 and get using it. You will find it better in the long run once you have learned how to use it.
manmis
April 20, 2012
Short!
Xrm.Page.getAttribute(“fieldName”).setValue([new {id: idValue, name: textValue, entityType: typeValue}]);
titus
June 18, 2012
can i know how to set range to price list to a product in sales navigation