There are times when you need to prompt the user in Infor CRM, to ask them some question to find out how to proceed – such as “would you like to do this or that?”. Often times, I’ve seen a QuickForm used for this, but that is less than ideal. There is a built-in, client-side dialog you can use for this. Let’s take a look how to use it.
Asking the User a Question Prompt
The javascript library Sage.UI.Dialogs contains a function called raiseQueryDialog. This function takes the following arguments:
- Title – this displays as the title of the dialog/prompt
- Question – this is the question you’d like to ask the user
- Callback function – this is the Javascript function that is invoked when the user chooses one of the prompts options
- Option #1 – the first choice for the user
- Option #2 – the second choice for the user
Let’s take a look at the code to use this (keep in mind, this is a client-side library, so this is Javascript):
// This is the callback function that is invoked when the user makes a choice
var fn = function(answer) {
if (answer) {
console.log('user selected option 1');
}
else {
console.log('user selected option 2');
}
};
// Display the prompt
Sage.UI.Dialogs.raiseQueryDialog('Some Question', 'Would you like to choose Option 1 or Option 2?', fn, 'Option 1', 'Option 2');
This is what the user will see when this code executes:

If you want to trigger server-side actions as a result, you could use __doPostBack (and pass the name of a server-side control, such as a button to trigger it’s change action).



