If you want to create a Dynamics CRM 2011 form pop and automatically populate fields in the form, one of the best ways to get the job done is to use query string values. CRM 2011 supports the option to populate fields using query strings.
To do this, you’ll need to add a string to the extraqs value in the query string:
You can populate the following field types with this method:
- Option sets
- Boolean fields
- Lookups (Custom Lookup, Customer Lookup , Owner Lookup)
Note: You can’t populate PartyList or regarding lookups with this method.
Populating the Option Set
Let’s say you want to auto-populate the Address Type in the account form. To do this, add address1_addresstype%3D1. The query string will look something like this:
Populating Boolean Fields
Populating Boolean fields will be similar to how you populate the options set. Set the field value and an integer value of 0 or 1.
Populating String Field
For the field name, add the following string after the field’s name:
/main.aspx?etc=1&pagetype=entityrecord&extraqs=name%3DPower Objects CRM
Populating the Date Field
Populating the Date field will be a little more complicated because the string will need to be coded. For example, if you want to display 07/04/2013, you will need a string of 07%2F04%2F13.
Populating Lookup Field
Populating a lookup field for a simple lookup will be the entity’s guid and the string. For example, let’s say our Primary Contact is Joe CRM. It would look like this:
If you use Customer or Owner, you will need to add the type of the lookup. For example, the owner system user will be:
1. If you get an error screen, you might have entered something incorrect in the query string or missed something this screen. This is what the error will look like:
2. You can combine several fields together. For example, if you want to populate two lookups and option sets, you will need to add the & sign.
3. Make sure that the guid that you are providing in the look up is the correct one.