How to read and write entity attribute in CRM 2011 via JScript? RRS feed

  • Question

  • I am still learning CRM and how to customize it.  Many of the things I would like to customize or automate in forms seem to be common desires of others who have posted the same or similar requests.  Unfortunately, these seemingly simple configurations or customizations cannot be done with the out-of-the-box UI.  I had some success with JScripts in forms by following examples others have posted.  For example, I was able to set the default Price List on the OnLoad event of Opportunity Form.  However, I would like to do more "intelligent" automation including:

    1. In the Quote Product Form, set the Unit field value to the default unit for the product selected in the Existing Product fields upon the OnChange.  I've seen some code to do this in JScript, but I don't think it would handle the case where there are different products with different default units.

    2. In the Quote Form, add a Tax Rate field and then automatically calculate the sale tax based on that rate.  I would like to have this tax field be populated OnLoad to a default tax rate.  Becuase we have different tax rates for different office locations, I would like to have that default tax rate be stored as an attribute to either a business unit or to an individual user.

    3. In the Quote and Order forms, use our own custom numbering scheme to override the default system generated ones.  I understand this is possible, but the issue of uniqueness is critical.  I would hope to create additional attributes to a user entity that I can use to generate these numbers to guarantee uniqueness.

    The three examples above assume that I can read (and write) attribute data from entitiy records.  Unfortunately, I have not had sufficient time to become knowledgeable enough to know how to do this via JScript and have not had too much luck trying to following some of the references in MSDN.  Anyone have a recommendation on how to do this?  To add to my confusion, I understand many of the examples I have been learning and testing were of the CRM 4.0 vintage and earlier, where crmForm is used, but it is now deprecated in CRM 2011.  Instead, xrm.Page is preferred.  So, I wonder how that affects the recommended interfaces or methods of reading and writing related entity data in CRM 2011?


    Wednesday, May 18, 2011 9:28 PM

All replies