- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2022 06:41 AM
Is there a way to prevent a catalog item form (portal) from being submitted if a certain choice value is selected in a variable select box?
Thanks,
AJ
Solved! Go to Solution.
- Labels:
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2022 07:14 AM
It depends on the values for the choices.
If you can go to the form, right click the Banks field and select 'Configure choices' you will see the Values for each of the choices.
Lets say that the value for Chase is: chase
and the value for TD Bank is: td_bank
function onSubmit() {
if(g_form.getValue('u_banks') == 'chase' || g_form.getValue('u_banks') == 'td_bank'){ //change u_banks with the name of your field
g_form.addErrorMessage('Request was not created'); //change with your message
//Make sure dirty form still works
g_form.submitted = false;
//Abort the submission
return false;
}
}
Replace the 'u_banks', 'chase', td_bank' with their actual names.
Please mark my answer as Correct/Helpful based on impact
Regards,
Dan H

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2022 06:47 AM
Yes, you can use an OnSubmit Client script.
In the client script, check if the value = the not allowed variable.
Then abort the action.
Example:
function onSubmit() {
if(g_form.getValue('priority') == 1){
alert('Record submission aborted.');
//Make sure dirty form still works
g_form.submitted = false;
//Abort the submission
return false;
}
}
Alternatively, you can stop the submission via the Server side, with a Business rule.
Before insert/update business rule. Running on the sc_req_item table and has the condition that request item == the item your referring to.
if(current.priority == 1){
gs.addInfoMessage('Record submission aborted.');
current.setAbortAction(true);
}
Please mark my answer as Correct/Helpful based on impact
Regards,
Dan H
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2022 06:59 AM
Thanks Dan. For the OnSubmit script if the select box field name is 'Banks' and the two choice values that make the form unsubmittable are 'Chase' and 'TD Bank' how would that look on the script?
Thanks,
AJ

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2022 07:14 AM
It depends on the values for the choices.
If you can go to the form, right click the Banks field and select 'Configure choices' you will see the Values for each of the choices.
Lets say that the value for Chase is: chase
and the value for TD Bank is: td_bank
function onSubmit() {
if(g_form.getValue('u_banks') == 'chase' || g_form.getValue('u_banks') == 'td_bank'){ //change u_banks with the name of your field
g_form.addErrorMessage('Request was not created'); //change with your message
//Make sure dirty form still works
g_form.submitted = false;
//Abort the submission
return false;
}
}
Replace the 'u_banks', 'chase', td_bank' with their actual names.
Please mark my answer as Correct/Helpful based on impact
Regards,
Dan H
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2022 07:28 AM
Perfecto! Thanks Dan.