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,...
Unanswered

How to get to the code behind a "+ New Record" button at the bottom of a lookup field?

(0) ShareShare
ReportReport
Posted on by 1,589

I have the need to pass parameters from the current form/record via the " New Record" button at the bottom of a lookup field.

Screen-Shot-2022_2D00_01_2D00_05-at-11.22.15-AM.png

I can already do this using Ribbon Workbench on Sub-grids and that works quite well.

However I also need to do it on the particular object circled in light blue as shown in the screen shot above.

How or what do I need to do  to access the code behind this so I can change it to include code similar to what is shown below.

Can this be accessed via Ribbon Workbench the same as I have accessed other buttons on the sub-grid and form for example, or is this something different?

 var formContext = primaryControl;
 var globalContext = Xrm.Utility.getGlobalContext();
 var client = Xrm.Utility.getGlobalContext().client.getClient();

    if (client == "Web") {
        if (rescom == 923190000 && interiorexterior == 923190000) {
            HideExteriorTabs(executionContext);

            if (SubGridName == InteriorTrim) {
                var parameters = {};
                parameters["interiorexterior"] = 923190000;

                // Define the entity name to open the form
                var entityFormOptions = {};
                entityFormOptions["entityName"] = "scenariotrim";

                Xrm.Navigation.openForm(entityFormOptions, parameters).then(
                    function (success) {
                        console.log(success);
                    },
                    function (error) {
                        console.log(error);
                    });
            }
        }
        
    }    

I have the same question (0)
  • Mohsin Ali Profile Picture
    3,634 on at

    Unfortunately you can't add script on that highlighted button. However, as soon as the new form opens you can add script at onload to get data from previous entity.

    UPDATE

    Other workaround is, add a button at the form where your lookup field is available. Now from here you can open form of that lookup entity and add parameters of whatever you want to pass. Please refer below article to open new form and to pass parameters to it.

    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

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
Tom_Gioielli Profile Picture

Tom_Gioielli 171 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 83

#3
Jimmy Passeti Profile Picture

Jimmy Passeti 50 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans