Archive
NullReferenceException while opening CRM form
I was getting an exception when I open a “Account” record.
When I verify the CRM server Event Viewer I got this below “NullReferenceException” warning message
After spending some time I came to know that the problem was because of customization change I did recently
Reason
- I deleted and recreated a custom field with same schema name but with different data type
- I had the new field added on my ‘Account’ form
Fix
I can’t say that it is a fix but below step worked for me
- Removed the field from the Form
- Publish the customization
- Add the field back to the Form
Here is a useful article which helped me
🙂
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
Please refer below useful MSDN articles
- http://msdn.microsoft.com/en-us/library/gg334375.aspx
- http://msdn.microsoft.com/en-us/library/gg334436.aspx
- Dynamics CRM Blog
Hope it helps 🙂