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?
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">
functioncommandResult(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:
When opening an opportunity on the Opportunities (CR304000) form, the Activities tab defaults when opportunity status is Open. Otherwise the Details tab defaults.
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">
functioncommandResult(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:
When opening an opportunity on the Opportunities (CR304000) form, the Activities tab defaults when opportunity status is Open. Otherwise the Details tab defaults.
@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?
We use 3 different kinds of cookies. You can choose which cookies you want to accept. We need basic cookies to make this site work, therefore these are the minimum you can select. Learn more about our cookies.