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

Map retrieved data to quick create form

(0) ShareShare
ReportReport
Posted on by 105

I have a ribbon button that retrieves data from api for the selected record and then opens the quick create form. How do i autofill this quick create form with the data retrieved from api? 

  • Verified answer
    Amit Katariya007 Profile Picture
    10,409 Super User 2025 Season 1 on at
    RE: Map retrieved data to quick create form

    Hello,

    Yes you can implement using "Xrm.Navigation.openForm" API. Just need some tweaks as per your logic.

    First of all you need to have a trigger point because without it you will not able to open the form.

    Then as you said you have the data from the API call, use this data and store it in an object and pass it to the "Xrm.Navigation.openForm" API.

    This API will open the quick create form and populate the data in that form.

    Lets say in below example you can see I have added a button on the account form and when a user will click on this button below JS will be called. This JS will open Contact quick create form and populate the data which I have provided(in your case replace this data with API data).

    pastedimage1652968649819v1.png

    function setField()
    {
        var entityFormOptions = {};
        entityFormOptions["entityName"] = "contact";
        entityFormOptions["useQuickCreateForm"] = true;
    
        // Set default values for the Contact form
        var formParameters = {};
        formParameters["firstname"] = "Sample";
        formParameters["lastname"] = "Contact";
        formParameters["fullname"] = "Sample Contact";
        formParameters["emailaddress1"] = "contact@adventure-works.com";
        formParameters["jobtitle"] = "Sr. Marketing Manager";
        formParameters["donotemail"] = "1";
        formParameters["description"] = "Default values for this record were set programmatically.";
    
        // Set lookup column
        formParameters["preferredsystemuserid"] = "279247f4-b5cd-ec11-a7b5-6045bd002bf6"; // ID of the user.
        formParameters["preferredsystemuseridname"] = " Admin user"; // Name of the user.
        formParameters["preferredsystemuseridtype"] = "systemuser"; // Table name.
        // End of set lookup column
    
        // Open the form.
        Xrm.Navigation.openForm(entityFormOptions, formParameters).then(
            function (success) {
                console.log(success);
            },
            function (error) {
                console.log(error);
            });
    }

    Also it will only populate those fields which are present on the form(in my case owner was not present on the form. so it will be not populated but you can refer and check how you can populate the lookup)

    pastedimage1652968725671v2.png

    docs.microsoft.com/.../openform

    Thank you,

    Amit katariya

  • sjov Profile Picture
    105 on at
    RE: Map retrieved data to quick create form

    Thanks, but I would like the fields to be automatically filled with the data retrieved from api.

  • Suggested answer
    Bipin D365 Profile Picture
    28,981 Moderator on at
    RE: Map retrieved data to quick create form

    Hello,

    You can try below code to prefill some of the field while opening Quick create form -

    var entityFormOptions = {};

    entityFormOptions["entityName"] = "contact";

    entityFormOptions["useQuickCreateForm"] = true;

    // Set default values for the Contact form

    var formParameters = {};

    formParameters["firstname"] = "Sample";

    formParameters["lastname"] = "Contact";

    formParameters["fullname"] = "Sample Contact";

    formParameters["emailaddress1"] = "contact@adventure-works.com";

    formParameters["jobtitle"] = "Sr. Marketing Manager";

    formParameters["donotemail"] = "1";

    formParameters["description"] = "Default values for this record were set programmatically.";

    // Set lookup column

    formParameters["preferredsystemuserid"] = "3493e403-fc0c-eb11-a813-002248e258e0"; // ID of the user.

    formParameters["preferredsystemuseridname"] = " Admin user"; // Name of the user.

    formParameters["preferredsystemuseridtype"] = "systemuser"; // Table name.

    // End of set lookup column

    // Open the form.

    Xrm.Navigation.openForm(entityFormOptions, formParameters).then(

       function (success) {

           console.log(success);

       },

       function (error) {

           console.log(error);

       });

    docs.microsoft.com/.../openform

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

Ramesh Kumar – Community Spotlight

We are honored to recognize Ramesh Kumar as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Holly Huffman Profile Picture

Holly Huffman 103

#2
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 96 Most Valuable Professional

#3
Gerardo Rentería García Profile Picture

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

Product updates

Dynamics 365 release plans