Answered by:
Setting a value to the lookup in ms crm 2011

Question
-
How to set a particular record to the Lookup field in ms crm 2011
- Edited by Gaurav.gupta.Capita Friday, September 16, 2011 12:02 PM
Friday, September 16, 2011 12:01 PM
Answers
-
Are you talking about JScript or .Net?
if JScript:
var olookup = new Object(); olookup.id = "tne id"; olookup.entityType = "entityName"; olookup.name = "the name"; var olookupValue = new Array(); olookupValue[0] = olookup; Xrm.Page.getAttribute("the attribute logical name").setValue(olookupValue);
if .Netentity["lookupLogicalName"] = new EntityReference("entityName", (Guid)theId);
My blog : http://mscrmtools.blogspot.com
All my tools for Dynamics CRM 4.0 on my dedicated site: MSCRMTools Repository
Upgraded tools for Dynamics CRM 2011!
View Layout Replicator | Searchable Property Updater | Ribbon Browser | SiteMap Editor | JavaScript Web Resource Manager- Proposed as answer by Jehanzeb.Javeed Saturday, September 17, 2011 7:49 AM
- Marked as answer by Gaurav.gupta.Capita Monday, September 19, 2011 6:46 AM
Friday, September 16, 2011 12:17 PMModerator
All replies
-
Are you talking about JScript or .Net?
if JScript:
var olookup = new Object(); olookup.id = "tne id"; olookup.entityType = "entityName"; olookup.name = "the name"; var olookupValue = new Array(); olookupValue[0] = olookup; Xrm.Page.getAttribute("the attribute logical name").setValue(olookupValue);
if .Netentity["lookupLogicalName"] = new EntityReference("entityName", (Guid)theId);
My blog : http://mscrmtools.blogspot.com
All my tools for Dynamics CRM 4.0 on my dedicated site: MSCRMTools Repository
Upgraded tools for Dynamics CRM 2011!
View Layout Replicator | Searchable Property Updater | Ribbon Browser | SiteMap Editor | JavaScript Web Resource Manager- Proposed as answer by Jehanzeb.Javeed Saturday, September 17, 2011 7:49 AM
- Marked as answer by Gaurav.gupta.Capita Monday, September 19, 2011 6:46 AM
Friday, September 16, 2011 12:17 PMModerator -
I believe this question refers to administration task. If it is YES, then any of the field which contains lookup field is recognized by the MSCRM as you have already updated that particular section with respective data. If not, it would ask you to ADD a new record either through file menu or at the bottom left side. This way you can set a record in that field or else if you enter anything without adding prior to that section, then CRM will be searching for that string you have entered in that box.
Hope this helps you.
Friday, September 16, 2011 11:49 PM -
If I just have the guid for the lookup value, how do I preselect that in the list?
Thanks,
Duneel
Wednesday, December 21, 2011 2:58 PM