- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-03-2020 02:31 AM
We get alot of updates from suppliers by email that are logged as interaction records via the Agent Workspace and then associated with incidents. To help analyst know when an interaction has been associated to an incident I am trying to create a business rule which will add a work note to an incident record each time a new interaction record is associated
So far i have located the table where the relationship is held 'interaction_related_record' and created a new on insert business rule (setup is below)
I am out of my depth when it comes to scripting and I cant seem to get the rule to run (although it doesn't show any errors either)
When to run
Task contains INC
Script
(function executeRule(current, previous /*null when async*/) {
var incWN = 'current.work_notes';
var inc = new GlideRecord('incident');
inc.addQuery('incident.number', current.task);
inc.query();
While(inc.next());
{
incWN = 'interaction associated';
}
})(current, previous);
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-03-2020 02:39 AM
Hi Chirs,
Write a After insert BR and change the script to this:
(function executeRule(current, previous /*null when async*/) {
var inc = new GlideRecord('incident');
inc.addQuery('sys_id', current.task);
inc.query();
if(inc.next());
{
inc.work_notes = 'interaction associated';
inc.update();
}
})(current, previous);
Mark helpful and correct if it helps.
Thanks,
CB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-03-2020 02:39 AM
Hi Chirs,
Write a After insert BR and change the script to this:
(function executeRule(current, previous /*null when async*/) {
var inc = new GlideRecord('incident');
inc.addQuery('sys_id', current.task);
inc.query();
if(inc.next());
{
inc.work_notes = 'interaction associated';
inc.update();
}
})(current, previous);
Mark helpful and correct if it helps.
Thanks,
CB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-03-2020 02:53 AM
Hi CB,
Your a legend, that works a treat.
Thanks for the quick assist
Kind Regards
Chris