- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-24-2018 03:13 AM
Hi All,
How to count the number of times the incident state sets to on-hold. And i want to send an email to caller whenever the state is on-hold along with the count.
**There is an OOB for Reopen count, is there anything similar to that we have.
How to achieve this, Kindly suggest.
Thank You
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-24-2018 04:51 AM
Hi,
Just write before insert/Update BR with the condition as stae changes to on_hold and with that script,
var count =current.u_onhold_count;
count++;
current.setValue('u_onhold_count', count);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-24-2018 04:48 AM
I am new to scripting side, my guess the script is incorrect.
i have a custom field as u_onhold_count (read-only)
var count = 0;
var gr = new GlideRecord('incident');
gr.query();
while(gr.next()){
if (gr.state == '3')
{
count++;
}
gr.setValue('u_onhold_count', count);
gr.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-24-2018 04:30 AM
Hi,
If you want to store the count then create custom filed like Reopen count and store the value whenever state changes to on-Hold.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-24-2018 04:47 AM
Yes, i am trying the same, but i am not able to set the value to that custom field.
I am new to scripting as well, so i am guessing my script is not correct.
var count = 0;
var gr = new GlideRecord('incident');
gr.query();
while(gr.next()){
if (gr.state == '3')
{
count++;
}
gr.setValue('u_onhold_count', count);
gr.update();
}
kindly suggest on the script

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-24-2018 04:50 AM
Hi
Is this a before insert update BR ?
Or you can do it from Action coloumn also. No need of a script.
Mark correct if it helps.
Regards,
Omkar Mone
www.dxsherpa.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-24-2018 04:51 AM
Hi,
Just write before insert/Update BR with the condition as stae changes to on_hold and with that script,
var count =current.u_onhold_count;
count++;
current.setValue('u_onhold_count', count);