Skip to main content

Notifications

Dynamics 365 Community / Forums / Finance forum / Add a Command Button, ...
Finance forum
Answered

Add a Command Button, but it open a Dialog Page

editSubscribe (0) ShareShare
ReportReport
Posted on by 948

In "CustTable" form(Details Master), it has an "+New" in the left-top of this form. It is a "Menu Item Button". After I click it, it will open a Dialog Page"DirPartyQuickCreateForm". However, I add a "Tab Page"("AAA") in Tab->TabPageDetails->TabHeader. In this "AAA" (Toolbar and List), I add an "Action Pan" with a "Button Group" and a "Grid". In "Button Group", I add three Command Button "New", "DeleteRecord" and "Save".  Now here is a problem, when I click this "New", but it also opens the Dialog Page "DirPartyQuickCreateForm".

1. How can I cancel this function? (Because I only want to add a record in this Grid.)

2. Is this function achieved by code or "qualities" setting? (I think this function will be useful in the future, so I want to learn how to do it.)

  • hinjorr Profile Picture
    hinjorr 2 on at
    Add a Command Button, but it open a Dialog Page
    I had a same issue but what i did is that I created new button and coded my logic what it needed then I override the init() method of the form and worte this code 
     
    public void init()
        {
            super();
            
            if (element.args().openMode() != OpenMode::New)
            {
                //
                // Setting the new record action in code rather than having it set on the form design
                // so that the form does an in-line create if it was opened in New mode
                //
                element.design().newRecordAction(formControlStr(StudentForm, NewStudent));
            }
        }
    NewStudent is the button which i created myself.
  • Suggested answer
    MA-30041859-0 Profile Picture
    MA-30041859-0 2 on at
    Add a Command Button, but it open a Dialog Page
    -
  • Suggested answer
    Rustem Galiamov Profile Picture
    Rustem Galiamov 8,070 on at
    RE: Add a Command Button, but it open a Dialog Page

    Hi JustZM!

    The command NEW and DELETE buttons always work on the first master data source on the form.

    https://docs.microsoft.com/en-us/dynamics365/unified-operations/dev-itpro/user-interface/system-defined-buttons

  • JustZM Profile Picture
    JustZM 948 on at
    RE: Add a Command Button, but it open a Dialog Page

    Hi Danyal

        Thank you! This will be a good way to do it! Thanks!

    Regards,

    JustZM

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Add a Command Button, but it open a Dialog Page
    Hi JustZM,
    Usually the above method solves this issue, I can't be sure until I can view them myself. The other option is to create a normal button and code on its clicked method (Give New to its Label and NormalImage property to make it look like a +New button). 
    public void clicked() 
    {
        yourDataSource_ds.create();
    }
  • JustZM Profile Picture
    JustZM 948 on at
    RE: Add a Command Button, but it open a Dialog Page

    Hi Danyal

    I think this way does not solve my problem.

    My Grid's DataSource is "JC_SchoolTable". Then I set all the DataSource of Tab Page, Action Pane, and Button Group to "JC_SchoolTable". But the New still opens the Dialog Page.

    After I delete the DataSource of  Tab Page, Action Pane, and Button Group. The New also opens Dialog Page.

    Regards,

    JustZM

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Add a Command Button, but it open a Dialog Page

    Hi JustZM,

    Make sure that you tab has a DataSource property that points to your grid table. This way when you click New, it will point to the DataSource that should create a new record (same goes for every other command).

Helpful resources

Quick Links

Take the Community feedback survey!

Answer this brief 15-question survey about your Community experience…

Demystifying Copilot: Service Edition with Sundar Raghavan

Sundar answers more questions about Copilot for Service...

Dynamics 365 Business Central vs Finance and SCM

Take a look at the key differences between Business Central and…

Leaderboard

#1
Andre Arnaud de Calavon Profile Picture

Andre Arnaud de Cal... 283,361 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 223,155 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,140

Featured topics

Product updates

Dynamics 365 release plans