Blog, Development, Howto

JS: How to get the originating record reference in the form script of the Quick Create Form

Just imagine that you need to define the context in which “Quick Create Form” was opened and depending on the context – to do some additional operations. In this short post I provide supported code you can use to define it.

Create JavaScript webresource and add following code inside:

Add this webresource to the “Quick Create Form” and register quickCreateOnLoad to handle OnLoad event of the form.

7 Comments

    1. Hello,
      This code should work fine for Online and UCI but I’m not fully certain that it’ll work for the on-prem and classic UI.
      Andrew

      1. Thanks, this code “Xrm.Utility.getPageContext().input.createFromEntity” doesn’t work if the parent form is in new mode. Is there a way to directly get the context of the parent form from the child quick create?

        1. That is a great question and I have no idea. What information in particular do you want to get from the parent record that was not created yet?

  1. This solution works perfect if u already have a record created (parent form) and invoke QC on top of it.

    Similarly, my users are creating new opp record (hasnt saved it yet), entered account info and for contact they tried to create a new contact record which is opening the QC form. Since the parent form – opp hasnt been created yet, i just need the info of the account GUID which i entered in my parent opp form. I tried above command but it returned null. In this unique scenario, how am i suppose to retrieve the account info?

    Thanks in advance

    1. Hello,
      In the case you described I don’t see any easy way to implement your requirement.
      Andrew

Leave a Reply to KK Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.