web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Auto Populate Address from Existing Contact into field in Opportunity Entity

(0) ShareShare
ReportReport
Posted on by

Hi All-

In the opportunity entity, after I use the look up to populate the "contact" field with the existing contact, is there a way for me have the address filed listed for that contact (in the contact entity) populate the address field in opportunity? For example, I am creating a opportunity for Joe (who's already a contact) and after I use the look up to find his name for the "contact", his address should auto populate in the custom field we have created. 

I tried setting up an N:1 relationship in opportunity_parent_contact to map address1_composite (Contact) to new_billtoaddress (Opportunity, a custom field we created) however, the information doesn't carry over after we select the specific contact.

Did I miss a step? Thank you in advance your support.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    SCV Profile Picture
    1,004 on at

    You will have to write some JavaScript to achieve this.

  • Community Member Profile Picture
    on at

    Hi Sachith,

    Thank you for the reply. I am not a coder nor would I know where to start with this one. Would you please provide me with more details, and or an example that might work?

    Thank you!

  • Suggested answer
    SCV Profile Picture
    1,004 on at

     

    Your JavaScript function will need to be registered on change of Contact lookup field on the Opportunity form and will need to do these:

    1. Get the contact id and using REST API get the address field values from the contact record. (You can use the REST builder to get this done easily) Check here: https://community.dynamics.com/crm/b/jasonlattimersblog/archive/2016/01/18/crm-rest-builder-2-3-0-0-now-with-web-api

    2. Then concatenate the address fields and set to the address text field on your opportunity form.

    You can use a quick view form to show the Contact’s address on the opportunity form instead of the above approach. But you can’t modify the address on the form. This is a no code approach.

    Check it here: https://technet.microsoft.com/en-us/library/dn531145.aspx

  • Suggested answer
    Community Member Profile Picture
    on at

    If you want this happen before saving, you can use JavaScript code. You can also use Plug-in to save address when the contact lookup change, the third way is to create a address as a calculation field.

    Here are something for OnChange event you can use in JavaScript:

    The OnChange event occurs at the field level. OnChange event triggers whenever data in a form field changes or focus is lost. Data validation happens before and after the OnChange event. Similar to OnLoad, any number of event handlers can be registered for OnChange of a field.

    All fields support the OnChange event. The OnChange event does not occur if the field is changed using script.

    Thanks

  • Verified answer
    RaviKashyap Profile Picture
    55,410 Moderator on at

    Hi,

    Relationship mapping works when you create the records from a subgrid/ associated view i.e. in your case it will work if you create the opportunity from the contact record.

    As suggested by Edison & Sachith, you would need to write JavaScript code to auto populate this on change of Contact however if you are looking for no code way then you can use Real Time workflows as well. Though this will work when you save the opportunity record and not when you select the contact on the opportunity record.

    You can refer the below screenshots if you would like to do this with workflows-

    -- Create a workflow on Opporutnity entity

    -- Trigger it on Create and contact field change

    -- Update the value of address from contact address. (in below screenshot, Address1 is renamed to street address)

    AutoAddress2.png

    AutoAddress2.png

  • Suggested answer
    Macoy Profile Picture
    275 on at

    Hi lakings27,

    Instead of populating address fields in opportunity, why not use the quick form view of CRM, this is much faster to display data of related entity.

    www.powerobjects.com/.../exploring-quick-view-forms-in-crm-2013

    Regards,

    Macoy

  • Community Member Profile Picture
    on at

    Hi Ravi-

    Thank you for the reply. The screen shots were a huge help, thank you! One question for you, the process is run after I close the opportunity window. Is there a way to execute the workflow after the record is saved?

  • Suggested answer
    RaviKashyap Profile Picture
    55,410 Moderator on at

    Hi,

    You dont need to close the window. The workflows should run if you have set the trigger on create and on field changes.

    If the setting/checkbox "Run this workflow in backgroud" is checked then the workflow will run in the background and can take some time to comple the execution. If you uncheck this, the workflow will run real time on create/update.

    Can uou check this setting? If doesnt work, can you share the svreenshot of your workflow?

  • Community Member Profile Picture
    on at

    Hi Ravi-

    Thank you, we had "run this workflow in background" checked. We unchecked it and it works great. Thank you for help.

    Thank you all for your support.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans