- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2023 08:58 AM
Hi everyone,
I'm Junior Developer and I'm stuck with this story and I need some help:
- As a Process User (itil) I want that when an incident is submitted, the system checks if the caller is "Joe Employee". If that is the case, an alert must inform that "You cannot submit an incident for Joe Employee" and prohibit incident submission. This should work for new and existing incident SO THAT Joe Employee is cannot submit incidents.
I know this is complete when I cannot have an incident with Joe Employee as the caller.
Portal is not in scope.
CLIENT SCRIPT:
SCRIPT INCLUDE:
Thank you very much in advance.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2023 09:08 AM - edited 04-13-2023 09:18 AM
Can you try below code:
if(g_form.getValue("caller") == "SYS_ID_OF_USER"){
alert("You cannot submit an incident for Joe Employee");
return false;
}
Please avoid using Async calls (GlideAjax) in on submit client scripts because they will take time to execute the logic until the form gets submitted.
If my answer solved your issue, please mark my answer as ✅Correct & 👍Helpful based on the Impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2023 09:15 AM
Don't use Script Includes with an onSubmit because you cannot guarantee that you'll get a response back before the submit is performed.
This would be much better as an onChange Client Script. That way you will always have the response back in time
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2023 09:08 AM - edited 04-13-2023 09:18 AM
Can you try below code:
if(g_form.getValue("caller") == "SYS_ID_OF_USER"){
alert("You cannot submit an incident for Joe Employee");
return false;
}
Please avoid using Async calls (GlideAjax) in on submit client scripts because they will take time to execute the logic until the form gets submitted.
If my answer solved your issue, please mark my answer as ✅Correct & 👍Helpful based on the Impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2023 09:15 AM
Don't use Script Includes with an onSubmit because you cannot guarantee that you'll get a response back before the submit is performed.
This would be much better as an onChange Client Script. That way you will always have the response back in time