Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Service | Customer Service, Contact Center, Fie...
Answered

Auto populate account for Selected contact

(0) ShareShare
ReportReport
Posted on by 40

Hi All

In the Opportunity form I want to auto populate account field when user select a contact. I have tried with JavaScript approach with below steps.

01.Get contact ID

02.Get AccountID for Contact ID

03.Get Account name

I feel there should be an easy way do this. Could you please help me?

  • RE: Auto populate account for Selected contact

    Thanks Leah

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Auto populate account for Selected contact

    Hi Saman,

    you can create a workflow to achieve it, which is a no code way and easier than js.

    You can refer following steps.

    1.Go Settings > Process to create a Real Time workflow on opportunity entity

     pastedimage1614133359017v5.png

    2.Trigger it on Create and contact field change.

    If you want to fill account from contact automatically for existing opportunities, you can check 'As an on-demand process'

     pastedimage1614131654797v2.png

    3.Update the value of account from contact.

     pastedimage1614131514808v1.png

    4.Save and Active it.

     pastedimage1614131846936v3.png

    5.Test.

    Fill contact field and save it, the account field will be filled automatically.

    pastedimage1614132343845v4.png

    Regards,

    Leah Ju

    Please mark as verified if the answer is helpful. Welcome to join hot discussions in Dynamics 365 Forums.

  • Suggested answer
    a33ik Profile Picture
    a33ik 84,325 Most Valuable Professional on at
    RE: Auto populate account for Selected contact

    Hello,

    The general logic for the script is following:

    1. Get the contact id from the form.

    2. Use Xrm.WebApi to get the information from the "contact" record.

    3. Populate the "company" lookup based on the data from the previous step.

    The most challenging part is step 2 and the following post gives you almost the fully functional script for that - www.inogic.com/.../

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,468 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,287 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans