[tweetmeme source=”BenHosk” only_single=false]
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
We blogged this experience here: http://www.interactivewebs.com/blog/index.php/server-tips/microsoft-crm-2011-how-to-configure-ifd-hosted-setup/
LikeLike
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.
LikeLike
Short!
Xrm.Page.getAttribute(“fieldName”).setValue([new {id: idValue, name: textValue, entityType: typeValue}]);
LikeLike
can i know how to set range to price list to a product in sales navigation
LikeLike
Hi, Can you help me please?
“value[0].id = idValue;
value[0].name = textValue;
value[0].entityType = typeValue;”
I didn’t get this part, id = i have to put the guid of the record?
name = i have to put the name of what? entity? record?
type = the user? systemuser? the entity :l
I’m nuts and newbbie in this javascript for CRM…
Thanks for the help.
LikeLike
id = the guid of the record
name = the text you usualy see in the lookup – (its the primary field of the record)
entityType = the logical name of the entity (like – account or contact …)
LikeLike
thnx…it worked
LikeLike
I have 14 records in the array, and i want to bind this array to the lookup control, how i can achieve it, please suggest
LikeLike
You cannot bind records to a CRM control.
If you want to bind arrays to controls you will need to create a new control and show it in an HTML page and Iframe
LikeLike