Wednesday, April 14, 2010

Owner fields and the Javascript Grid Editor

Since the release of my Javascript Grid Editor project, I've been blessed and blessed again by helpful and constructive contributors and developers helping me locate bugs and implementation-specific considerations.  One of the most annoying to date, has been the incompatibility of the script with Owner-type fields.

To be honest, I don't use Owner fields in my implementations of the script personally, so I was rather taken back to discover that the metadata for Owner-fields does not include a "Targets" node with information pointing to the "systemuser" entity, as every other Lookup in CRM does.  This troubles me because I'm fully aware that CRM 5 will introduce team-based ownership, and I anticipate they will use the "Targets" descriptor in the metadata to delineate ownership by either "systemuser" or "team" entities.

I've included a fix for this in the most recent update of my code, and published version 1.0.4 to the repository.  The fix operates during the retrieval of the metadata, and checks each attribute to determine two conditions: 1.) that it's an "Owner" attribute, and 2.) that no Targets were located.  If these conditions are met, the RetrieveEntity() function simply creates a single-target reference to the "systemuser" entity--which should fix the problem in all areas of the script.

I hope this bug hasn't precluded the implementation or deployment of the JGE to any CRM deployment that needs it, but if it has, please grab the latest version of the script and try it out!