Frequently Asked Question
How do I create a dialog page to get user confirmation?
Last Updated 8 years ago
We can use session.showPromptPage() in script to show a dialog page.
The method signature is as follow.
public int showPromptPage(String title, String message, String[] options);
The three parameters are as follows.
1) title - this is the dialog title
2) message - this is the message body
3) options - this is an array of String. This can be an array with single String if we just need user to acknowledge, or it can be an array of multiple String in case we want user to choose.
The method returns user selection which is 0-index based.
For example, let's say we have a subinventory called QUA for quarantined goods. We want to put a validation in Before Exit of "To Subinventory" field of Subinventory Transfer page so if user enters value of QUA in there, we will ask for user confirmation.
script:
if ("QUA".equals(INV.TOSUB.getValue())) {
int choice = session.showPromptPage("Warning", "You are transferring to Quarantine area. Are you sure?", new String[] {"Yes", "No"});
if (choice == 1) {
// user selects no
session.abortSystemHandler();
}
}
The method signature is as follow.
public int showPromptPage(String title, String message, String[] options);
The three parameters are as follows.
1) title - this is the dialog title
2) message - this is the message body
3) options - this is an array of String. This can be an array with single String if we just need user to acknowledge, or it can be an array of multiple String in case we want user to choose.
The method returns user selection which is 0-index based.
For example, let's say we have a subinventory called QUA for quarantined goods. We want to put a validation in Before Exit of "To Subinventory" field of Subinventory Transfer page so if user enters value of QUA in there, we will ask for user confirmation.
script:
if ("QUA".equals(INV.TOSUB.getValue())) {
int choice = session.showPromptPage("Warning", "You are transferring to Quarantine area. Are you sure?", new String[] {"Yes", "No"});
if (choice == 1) {
// user selects no
session.abortSystemHandler();
}
}