Interaction Related Record - Incident Work Note

Chris_Wilkinson
Tera Expert

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);

 

1 ACCEPTED SOLUTION

Chander Bhusha1
Tera Guru

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

View solution in original post

2 REPLIES 2

Chander Bhusha1
Tera Guru

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

Hi CB,

Your a legend, that works a treat.

Thanks for the quick assist

 

Kind Regards

Chris