In CRM 2011 we could use EntityReference to retrieve the lookup attribute from a Plugin.
Consider that we have a Contact lookup named as 'new_contact'. In the plugin we could use the following code to retrieve the lookup.
Code snippets:
CRM 2011:
EntityReference contactlookup = (EntityReference)targetEntity.Attributes["new_contact"];
CRM 4:
Hi,
ReplyDeleteI need to retrieve a checkbox attribute.
Any idea how I can do it?
And which function should I use to trigger that action because Retrieve function is not working.
Thank you
hello, Are you trying this from javascript or plugin ?
ReplyDeleteFrom Javascript :http://crmdm.blogspot.com/2011/03/how-to-retrieve-checkbox-value-in-crm.html
Also pls refer the following...http://crmdm.blogspot.com/2011/03/checkbox-onchange-event-is-not-working.html
Hi again,
ReplyDeleteI'm trying to get the lookup value, I got the ID but I wasn't able to get the text value.
I used contactLookup.Name.toString(), it's returning null.
How to do that?
Thank you
You could try this
ReplyDeletehttp://crmdm.blogspot.com/2011/03/how-to-retrieve-lookup-text-value-id.html
The other one is Jscript.
ReplyDeleteCan you continue the code on ow to get the text value?
Would appreciate that
Sorry i thought you were trying in js. That's very strange.So you got ID but not name. How about logical name?. Do you have any value in that?
ReplyDeleteGreat Post
ReplyDeleteThanks for sharing
The result retrieved shows as:
ReplyDeleteMicrosoft.Xrm.Sdk.EntityReference
How can i get the value of the lookup?