When Microsoft wrote the api for CRM 4 someone in their infinite wisdom thought it would be a great idea to have lots of CRM variables and lots of property variables.
This meant that developers had to spend hours casting variables to and from the CRM variables.
After a while you do get the hang of it but there are also some unusual variables
Like Key, Lookup, Customer etc.
The LookupProperty variable is quite a tricky one to get your head around
the offical SDK documentation doesn’t really help, have a read here
what did help was a plugin with an example, which I found in this example which shows plugins working for the outlook client.
This is the code to create a lookup property for my custom entity
Lookup salesPersonLookup = new Lookup(“new_salesperson”, crmkey.Value);
LookupProperty lookupProperty = new LookupProperty(“new_salespersonid”, salesPersonLookup);
first you need to create a lookup, this has the syntax of
new Lookup(“entity name”, guid of entity to lookup)
then you need to add the lookup into a LookupProperty
new LookupProperty(“field name”, Lookup)
You then add this property to your property bag and you will be able to update that property



jkmscrm
November 17, 2011
It’s good that they changed almost all the types in CRM 2011 to .net types making developer life easier
..
Regards
Jeevan.
Hosk
November 17, 2011
in my opinion that’s one of the best features of CRM 2011. It will save me hours of casting variables.
I’m not sure whey they made their own variables, I believe it was because CRM values can have nulls or something like that.
CRM for real estate
November 25, 2011
I read this post and I think That we can customize throw The options for managing Microsoft Dynamics CRM forms dynamically has increased tremendously in CRM 2011 – we can now, more than ever, tailor the look of a form to the specific type of record displayed.
Here are 2 functions I use to manage the form at runtime to show or hide sections or tabs based on data in the form.