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 :
Microsoft Dynamics CRM (Archived)

How to open a pre-populated form to create a record in Crm 2011 using Javascript

(0) ShareShare
ReportReport
Posted on by

Hi,

I have a requirement where on save of an Account record, a new  Account form should open in a new window to create a new Account record and when the form opens its fields should be pre populated with values on the previous form(i.e the record we created before this form opened) using Javascript. How can I do that ? 

Can someone help me with a piece of code?

Thanks

*This post is locked for comments

I have the same question (0)
  • Verified answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello Bob,

    Here is MSDN article that describes feature you want to implement - msdn.microsoft.com/.../gg334375.aspx

  • Verified answer
    gdas Profile Picture
    50,091 Moderator on at

    Hello Bob,

    Here is sample code , you need to registered the function "OnSaveAccount" in Account entity onsave event.

            function OnSaveAccount() {  
                Xrm.Page.data.save().then(successSubmitCallback, errorSubmitCallback);
            }
            function successSubmitCallback() {
                var parameters = {};
                var windowOptions = {
                    openInNewWindow: false // You can open in a new window . False means its just redrect to new form
                };
    
                parameters["name"] = Xrm.Page.getAttribute("name").getValue(); // pass parameter getting from current account attribute
                parameters["accountnumber"] = Xrm.Page.getAttribute("accountnumber").getValue();// pass parameter getting from current account attribute
    
                window.parent.Xrm.Utility.openEntityForm("account", null, parameters, windowOptions); // Open new creation form
            }
            function errorSubmitCallback() {
                alert('Error Occurred');
            }


  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Goutam,

    I don't think that any of Xrm.Page.data.save() or Xrm.Utility.openEntityForm() were available in CRM 2011. Correct me if I'm wrong.

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 > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans