This project is read-only.

XrmServiceToolkit.Extension Methods

With the integration of jQuery in the latest version of XrmServiceToolkit, some new functions are introduced.

  • JQueryXrmDependentOptionSet: Create Configurable Dependent Option Set to utilize CRM 2011 web resource.
  • JQueryXrmFieldTooltip: Create configurable tooltip for fields on CRM 2011 form
  • JQueryXrmCustomFilterView: Create configurable ability to add custom filter view to crm 2011 lookup field on the form
  • JQueryXrmFormatNotesControl: Format the notes control to allow insert, allow edit

Here is an exmaple of the usage about these methods. The parameter passed is the XML web resource name in your CRM solution. [NOTE] Users will need rights to be able to retrieve web resource for these methods to work

account_onLoad = function () {
    try {
        //Examples about how to use the extension mehtods.
    catch (err) {

account_accountcategorycode_onChange = function () {
    try {
    catch (err) {


This function provides a configurable approach to setup dependent optionset in a XML web resource. The origin of the method is from CRM 2011 SDK with the update to use jQuery and move away from passing parameters and also make the method generic to use.

  <entity name="account">
    <ParentField id="accountcategorycode" label="Category">
      <DependentField id="accountclassificationcode" label="Classification" />
      <Option value="1" label="Preferred Customer">
        <ShowOption value="1" label="VIP" />
        <ShowOption value="2" label="MVP" />
      <Option value="2" label="Standard">
        <ShowOption value="3" label="International Company" />
        <ShowOption value="4" label="National Wide Company" />
        <ShowOption value="5" label="Private Company" />

Once the method is called. The result should be like the following attached pictures.

Dependent OptionSet Result

Dependent OptionSet Result 2


This function provides a configurable approach to setup tooltip for crm entity fields. The method was orginated from with modification to support cross browser and generic to use

Once the method is called. The result should be like the following attached pictures.

  <entity name="account">
    <attribute name="name">
      <shorthelp>&lt;br/&gt;&lt;br/&gt;This is the first line&lt;br/&gt;This is the second line</shorthelp>

Field Tooltip


This function provides a configurable approach to add custom filter view to a lookup field. The purpose of this method is to provide

  • If the lookup will need to be filtered with certain conditions (filter by the value of standard field,  optionset by value / label. a random lookup id / name.
  • If the lookup (party list) will need to have 'default type' set.

[NOTE] The limitation of this method is obvious. Complex query like "filtered lookup with addtional conditions". Also fields like owner is not working with AddCustomView.

  <!-- The entity where the lookup field. Add other entity tags for other entities -->
  <entity name="account">
    <!-- Use the template to add filter view for other fields -->
    <targetField id="new_primarycontactid" viewentity="contact" viewname="Filtered Lookup View">
        <!-- this section defines the fields for which their values will be used to replace the correspondent fetchnote -->
        <!-- define all the fields if you need to use the values to build the correct fetch XML -->
        <field name="new_originatedcountry" operator="contains" fetchnote="fnCountry"></field>
      <!-- using advanced find to get the fetchXml -->
      <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
        <entity name="contact">
          <attribute name="fullname" />
          <attribute name="telephone1" />
          <attribute name="contactid" />
          <order attribute="fullname" descending="false" />
          <filter type="and">
            <condition attribute="new_country" operator="like" value="fnCountry" />
            <condition attribute="statuscode" operator="eq" value="1" />
      <!-- this is the grid for the view -->
      <grid name="resultset" object="1" jump="contactid" select="1" icon="1" preview="1">
        <row name="result" id="contactid">
          <cell name="fullname" width="200" />
          <cell name="new_country" width="200" />
          <cell name="telephone1" width="200" />

Once the method is called. The result should be like the following attached pictures.

Custom Filter View for Lookup

Happy Coding!


Last edited Jan 25, 2013 at 2:58 PM by jaimieji, version 13


No comments yet.