- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2024 01:40 AM
Hi!
I'm currently developing a client script on Incident table, but when I'm testing it, it gives me an error that i don't understand.
Its a simple script and it shouldn't allow in new or existing incidents
How can i solve this?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2024 01:52 AM - edited 12-18-2024 01:55 AM
Hi @NMMZ10 ,
In client script you access with g_form no need new object like below:
var category = g_form.getValue('category');
var priority = g_form.getValue('priority');
Use below script it will work.
function onSubmit() {
var category = g_form.getValue('category');
var priority = g_form.getValue('priority');
if (category == 'database' && priority == '1') {
g_form.addInfoMessage('Critical incidents are not allowed for category Database');
return false;
}
return true;
}
If my response helped, please mark it as the accepted solution ✅ and give a thumbs up👍.
Thanks,
Anand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2024 01:58 AM
Hello @NMMZ10
Please try this script:
function onSubmit() {
var category = g_form.getValue('category');
var priority = g_form.getValue('priority');
if (category == 'database' && priority == '1') {
g_form.addInfoMessage('Critical incidents are not allowed for category Database');
return false; // Prevent form submission
}
return true; // Allow form submission
}
Screenshot onSubmit Client Script:
Screenshot Info message:
"If you found my answer helpful, please like and mark it as an "accepted solution". It helps others find the solution more easily and supports the community!"
Thank You
Juhi Poddar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2024 01:52 AM - edited 12-18-2024 01:55 AM
Hi @NMMZ10 ,
In client script you access with g_form no need new object like below:
var category = g_form.getValue('category');
var priority = g_form.getValue('priority');
Use below script it will work.
function onSubmit() {
var category = g_form.getValue('category');
var priority = g_form.getValue('priority');
if (category == 'database' && priority == '1') {
g_form.addInfoMessage('Critical incidents are not allowed for category Database');
return false;
}
return true;
}
If my response helped, please mark it as the accepted solution ✅ and give a thumbs up👍.
Thanks,
Anand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2024 01:58 AM
Hello @NMMZ10
Please try this script:
function onSubmit() {
var category = g_form.getValue('category');
var priority = g_form.getValue('priority');
if (category == 'database' && priority == '1') {
g_form.addInfoMessage('Critical incidents are not allowed for category Database');
return false; // Prevent form submission
}
return true; // Allow form submission
}
Screenshot onSubmit Client Script:
Screenshot Info message:
"If you found my answer helpful, please like and mark it as an "accepted solution". It helps others find the solution more easily and supports the community!"
Thank You
Juhi Poddar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2024 02:04 AM
Hello @NMMZ10
Thanks for marking my post helpful.
As per the new community policy you can mark multiple correct answers.
Can you please mark my answer as an accepted solution, so that others can find the solution easily and supports community.
Thank You
Juhi Poddar