Solved

Screen 'Change Orders' need to set specific tab to be open by default

  • 6 August 2022
  • 3 replies
  • 147 views

Userlevel 2
Badge

The Chage Orders screen PM308000 was opening with the Cost Budget tab selected.  Would like to change it to have the Change Requests tab selected.  I used the Screen Editor to set the SelectedIndex and tried all numbers between 0 and 9.  Below shows what tab ended up being selected. 

None of the numbers I tried set Change Requests tab to be selected.  The Change Requests and Revenue Budget have a value in the VisibleExp property.  If you watch closely when opening the Change Orders screen, Change Requests and Revenue Budget are not initially on the screen, but then appear.

How can I make Change Requests tab be the one selected by default when opening the screen?

icon

Best answer by Laura02 6 August 2022, 11:58

View original

3 replies

Badge +16

Hello @andreagr ,

I found a similar question with the answer posted. I hope this helps you.

 

This article explains the approach showing how to conditionally change a default tab on the entry form.

 

Step-by-step guide

 

Suppose that you need to implement the following use case: if opportunity status is Open, the Activities tab gets selected by default on the Opportunities (CR304000) form. For all other opportunity statuses, the Details tab is selected by default.

To default Activities tab for Open opportunity, you should complete the following steps:

Step 1: Add JavaScript function as below:

<script type="text/javascript">

        function commandResult(ds, context){

           var tabControl, statusControl;

            if(context.command != "Insert"){

                for(var key in ds.px_context.px_all){

                    if (key.indexOf("_tab") > 0){

                        var xControl = ds.px_context.px_all[key];

                        if (xControl.__className == "PXTab"){

                            tabControl = xControl;

                        }

                    }

                    if (key.indexOf("_edStatus") > 0){

                        statusControl = ds.px_context.px_all[key];

                    }

                }

                if (tabControl && statusControl) {

                    var statusval = statusControl.getValue();

                    if (statusval == 'O') {

                        tabControl.setSelectedIndex(2);

                    }

                    else {

                        tabControl.setSelectedIndex(0);

                    }

                }

            }

        }        

In this function, we are retrieving PXTab control and Editor control for the Status field. And we are using PXTab control's setSelectedIndex method to select a particular tab.

Step 2: Include this function in page PXDataSource as below:

<px:PXDataSource ID="ds" runat="server" Visible="True" Width="100%"

             TypeName="PX.Objects.CR.OpportunityMaint" PrimaryView="Opportunity">

             ...

             <ClientEvents CommandPerformed="commandResult"/>

             ...        

Results

 

When opening an opportunity on the Opportunities (CR304000) form, the Activities tab defaults when opportunity status is Open. Otherwise the Details tab defaults.

 
 
 
 
 

 

 

 

Userlevel 2
Badge

@laura01 Thank you for this information, however, I am not a programmer and I don’t understand what to do with the information in the post.  Where does the Javascript go?

Badge +16

Hello Adreagr,

I am not a programmer either. The next step may be to speak to your partner. Good luck!

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved