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 :
Customer experience | Sales, Customer Insights,...
Answered

Auto-populating data on Lead form

(2) ShareShare
ReportReport
Posted on by 8
My question/problem is around how data is populated on the Lead form. We utilize an field called "Existing Contact" in the BPF which is linked to the Parent Contact for Lead field (see attached screenshot). We also use a field called "Existing Account" which is tied to the Parent Account for Lead field. When we enter in a contact in the Existing Contact field, it populates the First Name, Last Name, Business Phone, Mobile Phone and Email fields. However, when we enter an account in the Existing Account field, it ONLY populate the Company Name. It doesn't pull in the phone, website, address, etc.
 
My question is what is used to pull this data in? I was thinking it was a Java Script that when the lookup was filled it would populate the other fields. I do not have any workflows that run when those fields are filled in to populate the data. Any thoughts?
Lead Form.jpg
Categories:
I have the same question (0)
  • Suggested answer
    Inogic Profile Picture
    715 on at
    Hi,
     
    The values populating when selecting an Account or Contact in the Existing Account or Existing Contact fields is out-of-the-box (OOB) behavior.
    • If you select an Account in the Existing Account field, the Company Name will be populated.
    • If you select a Contact in the Existing Contact field, the Last Name, First Name, Job Title, Business Phone, Mobile Phone, and Email associated with that Contact will be populated.
    However, if you have already entered different values in those fields, they will not be overwritten.
     
    Hope this helps.
     
    Thanks!
    Inogic
  • Verified answer
    Hamza H Profile Picture
    1,807 on at
    function populateAccountDetails(executionContext) {
        var formContext = executionContext.getFormContext();
        var accountLookup = formContext.getAttribute("parentaccountid").getValue();
    
        if (accountLookup && accountLookup.length > 0) {
            var accountId = accountLookup[0].id.replace("{", "").replace("}", "");
    
            Xrm.WebApi.retrieveRecord("account", accountId, "?$select=telephone1,websiteurl,address1_line1,address1_city,address1_stateorprovince,address1_postalcode")
                .then(function(result) {
                    formContext.getAttribute("telephone1").setValue(result.telephone1);
                    formContext.getAttribute("websiteurl").setValue(result.websiteurl);
                    formContext.getAttribute("address1_line1").setValue(result.address1_line1);
                    formContext.getAttribute("address1_city").setValue(result.address1_city);
                    formContext.getAttribute("address1_stateorprovince").setValue(result.address1_stateorprovince);
                    formContext.getAttribute("address1_postalcode").setValue(result.address1_postalcode);
                },
                function(error) {
                    console.log("Error retrieving account: " + error.message);
                });
        }
    }
    
     
  • Verified answer
    Muhammad Shahzad Shafique Profile Picture
    2,373 Most Valuable Professional on at
    The automatic population of fields (e.g., name, phone, email) when selecting Existing Contact is handled by out-of-the-box (OOB) JavaScript in the Lead form.
    For Existing Account, only Company Name is populated by default. Dynamics 365 does not natively auto-populate other fields like phone, website, or address from the selected account.
    Conclusion:
    Yes, JavaScript (likely on the Lead form) is responsible for populating the contact-related fields. To replicate similar behavior for the account, you need to implement a custom JavaScript function triggered on the Existing Account field's OnChange event to fetch and populate the desired account fields.


     

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 > Customer experience | Sales, Customer Insights, CRM

#1
Pallavi Phade Profile Picture

Pallavi Phade 98

#2
Tom_Gioielli Profile Picture

Tom_Gioielli 60 Super User 2025 Season 2

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 43 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans