Skip to main content

Notifications

Announcements

No record found.

Service | Customer Service, Contact Center, Fie...
Answered

Auto populate account for Selected contact

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,323 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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans