CRM 4 pulling over additional fields after choosing lookup

الإجابة CRM 4 pulling over additional fields after choosing lookup

  • lunedì 7 maggio 2012 14:14
     
     

    Hello,

    Could anyone point me in the right direction for my question.

    Basically on my 'Account' Form I have a 'Contact' lookup field.  When I choose the lookup and select a record, I also want it to pull over a couple text fields (Job Title, Phone Number) to be displayed next to the chosen lookup.  Is this as easy as a out of the box mapping option, or would this require jscript on the OnLoad page?

    I just needed confirmation before I started writing

    Thanks

Tutte le risposte

  • lunedì 7 maggio 2012 14:22
    Moderatore
     
     Con risposta

    It depends.

    Entity relationship field mapping is triggered only when you create a new related record from the associated grid screen of the primary record. In your example, this means when creating a contact from the associated contact's grid on the account form. It will not be triggered when you use a lookup to set the primary record for a related record, so to meet your requirement you will need to use an alternative method.

    There are two approaches:

    1. A JavaScript web service call to retrieve the values from the primary record and populate similar fields on the related record. Here's a blog article with some sample code.
    2. Write a plugin that will retrieve the values from the primary record and populate similar fields on the related record.

    I've started before with the JavaScript method, but changed to the plugin method. The plugin method is better because it can be triggered to fire when any of the field values change on the primary record so the copied fields on the related records are always kept up to date. You can't so this with JavaScript, so the fields become out-of-date over time, and JavaScript is a drag on client browser performance.

    Hope that helps. Neil


    Neil Benson, CRM Addict and MVP at Slalom Consulting. Find me on Twitter. Join over 20,000 other CRM professionals on the Microsoft Dynamics CRM group on LinkedIn.

    • Contrassegnato come risposta Mitchell2012 lunedì 7 maggio 2012 14:32
    •