- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2024 02:55 PM
Hello Now Community,
Apologies ahead my scripting skills are not the best.
I have two onSubmit catalog clients working seperately below however when both are enabled only one will work. My requirement is to display a single error messages "Please use SailPoint Access Request" or "Please use SAP Access Request" based off a yes/no variable.
onSubmit Catalog Client Script #1
function onSubmit() {
if(g_form.getValue('do_you_have_access_to_submit_for_the_emergency_access_through_grc') == 'yes')
g_form.addErrorMessage('Please use SAP Access Request');
g_form.submitted = false;
//Abort the submission
return false;
}
onSubmit Catalog Client Script #2
function onSubmit() {
if(g_form.getValue('do_you_have_access_to_submit_for_the_emergency_access_through_grc') == 'no')
g_form.addErrorMessage('Please use SailPoint Access Request');
g_form.submitted = false;
//Abort the submission
return false;
}
How can I combine the two above into one onSubmit Catalog Client script?
Thank you,
Mark
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2024 03:14 PM
@Mark Nguyen : I just combined two into a single script.
function onSubmit() {
if (g_form.getValue('do_you_have_access_to_submit_for_the_emergency_access_through_grc') == 'yes') {
g_form.addErrorMessage('Please use SAP Access Request');
g_form.submitted = false;
}
if (g_form.getValue('do_you_have_access_to_submit_for_the_emergency_access_through_grc') == 'no') {
g_form.addErrorMessage('Please use SailPoint Access Request');
g_form.submitted = false;
}
//Abort the submission
if (g_form.submitted == false) {
return false;
}
}
Please mark this as correct answer and helpful if it resolved, or mark this helpful if this help you to reach towards solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2024 03:04 PM
@Mark Nguyen : As it's a yes/no variable only one error message will be displayed at any time right? As the value should be either yes or no? Is my understanding correct?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2024 03:12 PM
Hi @Sainath N yes that is correct only one error message will be displayed at any time. The error message to be displayed is dependant on yes or no selection to variable 'do_you_have_access_to_submit_for_the_emergency_access_through_grc'.
If no is selected, I want the error message 'Please use SailPoint Access Request' displayed.
If yes is selected, I want the error message 'Please use SAP Access Request' displayed.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2024 03:14 PM
@Mark Nguyen : I just combined two into a single script.
function onSubmit() {
if (g_form.getValue('do_you_have_access_to_submit_for_the_emergency_access_through_grc') == 'yes') {
g_form.addErrorMessage('Please use SAP Access Request');
g_form.submitted = false;
}
if (g_form.getValue('do_you_have_access_to_submit_for_the_emergency_access_through_grc') == 'no') {
g_form.addErrorMessage('Please use SailPoint Access Request');
g_form.submitted = false;
}
//Abort the submission
if (g_form.submitted == false) {
return false;
}
}
Please mark this as correct answer and helpful if it resolved, or mark this helpful if this help you to reach towards solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2024 03:19 PM
Thank you very much @Sainath N this worked! Appreciate it greatly.