Home > CRM, CRM 2011, CRM 4.0, JScript > Set field values using query string parameters on Form load in CRM

Set field values using query string parameters on Form load in CRM

Hi,

I have got below requirement,

  •  I need to open a CRM form from my custom ‘.aspx’ page.
  • On opening of the form I should populate “name” field with value

After referring MSDN article, I came to know that we can set the field values using “extraqs” query string parameter and it must meet below requirements.

  • You must encode the parameters passed in the extraqs parameter. Use encodeURIComponent to encode the parameters.
  • The names of the query string arguments must match or include the names of attributes for the entity.
  • The value cannot be a script (To prevent script injection)

Below is the sample JScript to open a form and populate “name” field on form load

function openform() {
var encodedString = encodeURIComponent(“new_name=rajeev pentyala”);
window.open(“http://ServerName/OrgName/main.aspx?etc=10014&extraqs=” + encodedString + “&pagetype=entityrecord”);
}

  • Here “new_name” is the name of attribute

You get the CRM form as below, when you call the above function

extraqs query parameter

extraqs query parameter

Please refer below useful MSDN articles

Hope it helps 🙂

Advertisement
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: