- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2023 05:42 AM
Hello Experts
If any incident is on New or assigned state and assignment group is AB and short description or description field contains "phish" "hack" "theft" words then display an error message. error message is '' Ticket contains security related content. Please check if this incident is IT Security related and update the ticket category accordingly".
If incident category is not security then we need to restrict to update the form and display error message. and
If incident category is updated to security then restriction not needed on update or save.
help me to achieve this.
Best Regards,
Gnani
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2023 06:03 AM
Hi @Nani18 ,
If you are trying to achieve this through BR then follow below thing
Ideally state and group can be kept in when to run condition but if you need it in scripting there as well you can use them.
var state = current.state; // this will give you the state
var group = current.assignment_group; //this will give you the group sys_id
var category = current.category; //this will give you the category
var notes = current.work_notes; //this will give you the work notes; specify correct column name whether it is work_notes or additional_comments or comments as per your requirement
if(state == "1" || state == "2" && group = "AB" && category = "security"){ //the condition is just reference for you
if(notes.includes("phish") || notes.includes("hack") || notes.includes("theft")){
gs.addErrorMessage("Ticket contains security related content. Please check if this incident is IT Security related and update the ticket category accordingly")
}
}
Please mark correct if my response has solved your query.
Cheers,
Mohammed Basheer Ahmed.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2023 02:53 AM
Hi @Nani18
Where do you want this to be added.
else if(category != "security" && securityIndex == false){
//write your code here
}
Please mark correct if my response has solved your query.
Cheers,
Mohammed Basheer Ahmed.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2023 06:03 AM
Hi @Nani18 ,
If you are trying to achieve this through BR then follow below thing
Ideally state and group can be kept in when to run condition but if you need it in scripting there as well you can use them.
var state = current.state; // this will give you the state
var group = current.assignment_group; //this will give you the group sys_id
var category = current.category; //this will give you the category
var notes = current.work_notes; //this will give you the work notes; specify correct column name whether it is work_notes or additional_comments or comments as per your requirement
if(state == "1" || state == "2" && group = "AB" && category = "security"){ //the condition is just reference for you
if(notes.includes("phish") || notes.includes("hack") || notes.includes("theft")){
gs.addErrorMessage("Ticket contains security related content. Please check if this incident is IT Security related and update the ticket category accordingly")
}
}
Please mark correct if my response has solved your query.
Cheers,
Mohammed Basheer Ahmed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2023 02:20 AM
Hello Basheer,
Thanks for your help
Above script is working fine . and I need to add one more condition in the script in incident form security incident select box is false and category is not security it wont allow to save the incident. How to do this
and main problem is error message is showing in Platform and portal as well . I need only in platform .
Best Regards,
Gnani

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2023 02:53 AM
Hi @Nani18
Where do you want this to be added.
else if(category != "security" && securityIndex == false){
//write your code here
}
Please mark correct if my response has solved your query.
Cheers,
Mohammed Basheer Ahmed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2023 03:06 AM
Hello Basheer ,
How we can restrict error message in Service portal .