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

Announcements

News and Announcements icon
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? 

I have the same question (0)
  • Suggested answer
    Bipin D365 Profile Picture
    28,985 Moderator on at

    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

  • sjov Profile Picture
    105 on at

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

  • Verified answer
    Amit Katariya007 Profile Picture
    10,409 Moderator on at

    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

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Manoj - ManoVerse Profile Picture

Manoj - ManoVerse 131 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 95

#3
Hamza H Profile Picture

Hamza H 30 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans