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:

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

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.
