- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2023 08:13 AM - edited 08-07-2023 09:21 AM
hi all,
how to hide "Awaiting Caller" for the following condition
incident with contact type "Event Monitoring", state On-Hold, contact type !==event Monitoring, category !== Event_Management and there should be no possibility to add
on the onhold reason "awaiting caller", except for incident tickets with contact type "event Monitoring",
category "Event_Management".
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2023 11:33 PM
Hi Harish Kota,
thanks for your reply..
i got solution using ui policy conditions with run script- g_form.removeOption('hold_reason','1');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2023 09:21 AM
you can write before business rule on incident table ,
when to run tab select your condition as below
state is on hold
contact type/caller is not "event Monitoring"
category is not "Event_Management"
Actions tab
Add message true / checked
"You cannot add on hold reason for category - event management and called event monitoring.
Abort true / checked
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2023 09:33 AM
i don't to add message "You cannot add on hold reason for category - event management and called event monitoring".
i want to hide Awaiting Caller in on hold reason, other choices should be there in on hold reason.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2023 11:20 AM
Hi @Mohammad Moula ,
Hope you are doing great.
Here's the solution:
- Navigate to "Business Rules" in ServiceNow.
- Create a new Business Rule with an appropriate name, such as "Hide Awaiting Caller for Event Monitoring Incidents."
- Set the "Applies to" field to "Incident."
- Add a condition to check if the incident meets the specified criteria:
// Condition: incident with contact type "Event Monitoring", state On-Hold,
// contact type !== "Event Monitoring", category !== "Event_Management"
current.state == 3 && current.u_contact_type == "Event Monitoring" &&
current.category != "Event_Management"
- In the "Advanced" tab of the Business Rule, add the following script to prevent the addition of "Awaiting Caller" on-hold reason:
(function executeRule(current, previous /*null when async*/) {
var onHoldReasons = current.u_on_hold_reason.getChoices();
var awaitingCallerIndex = onHoldReasons.indexOf("Awaiting Caller");
// If "Awaiting Caller" is found, remove it from the on-hold reasons
if (awaitingCallerIndex > -1) {
onHoldReasons.splice(awaitingCallerIndex, 1);
current.u_on_hold_reason.setChoices(onHoldReasons);
}
})(current, previous);
Regards,
Riya Verma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2023 02:43 AM
Hi Riya Verma,
thanks for your reply.
Business rule you suggested not working, i tried the following client script but working partially
var contacttype = g_form.getValue('u_contacttype');
var category = g_form.getValue('category');
var state = g_form.getValue('state');
if(contacttype == 'Event Monitoring' && state == '3' && category != 'Event_Management')
g_form.removeOption('hold_reason','1');
else {
if(contacttype == 'Event Monitoring' && state == '3' && category == 'Event_Management')
g_form.addOption('hold_reason','1');
}
please suggest any changes to work code as required.