Stefan Pienaar
I would love to change the world, but they won't give me the source code

FetchXML from JavaScript on CRM 5

December 15, 2011 14:01 by StefanPienaar

I found this awesome helper script which makes calling FetchXml queries a breeze from JavaScript in CRM 5.

As an example, I’ll automatically set the price list and currency on a new Quote when the potential customer is selected.

1. Add 2 new web resources to CRM (set the type on both to “Script (JScript)”)

   - Name the one “new_Quote” and the other “new_FetchUtil”

2. Add the this text into the text editor for new_Quote.

3. Add the this text into the text editor for new_FetchUtil.

4. Publish both web resource files.

5. Customize the Quote entity’s form.

   - Add the 2 created web resources to the Form Libraries.

   - Add the OnLoad function in the new_Quote Library to the Load event of the form:

image

   - Add the OnCustomerChange function to the Potential Customer Lookup’s change event:

image

7. Publish the Quote entity.

6. When creating a new Quote, select the applicable Account and the Price List and Currency fields should be set automatically.

image


Categories: Microsoft CRM 5
Actions: E-mail | Permalink | Comments (0)