views:

1181

answers:

1

When I have a custom entity Referral, the primary attribute is a refid and this is what shows up in associated views (as the link text that opens Referral form). I need to change this name to something that is generated from entity attributes). Something like:

Referral.ToString() { return ref.id + " " + ref.first_name + " " + ref.last_name + " "; }

instead of the default ref.id.ToString() -- or however it works.

Is this possible via the MS CRM 4? I fear it might not be (having clicked through the gui customizations for a while), but maybe I missed something.

If not, what is the most elegant way of doing this? A javascript function would need to be somewhere global (otherwise it would need to be copy+pasted to every form/view that mentions Referral). Also, the javascript function (I assume), would need to do at least one additional XmlFetch on every view.

Any suggestions, comments, ideas welcome. I've started modifying the MS CRM at work and I keep hitting issues that I feel have been solved by open source python web frameworks over and over again. Please help a poor soul at work :)

A: 

I've found the easiest way of handling this is to populate the primary attribute with the fields you want concatenated. You can do this in javascript on the form, a plugin registered to fire on create and on change of any of the attributes you want, or a combination of both.

Unfortunately, there's no (supported) way to change the primary attribute after create of an entity. You'd have to recreate the entity with something like prrfix_name as the primary attribute, and then combine your id, first_name, and last_name fields.

Trying to alter CRM's behavior re: displaying the primary attribute would be completely unsupported, and probably pretty technically daunting and take a huge chunk of time. I'd just take the time hit to recreate the entity with a new primary attribute.

Matt
Thanks, it would be nice if there was a more flexible solution (especially if client later decides to change his mind), but at least it is a _solution_. :)
pithyless