Fire an event

AbidJafrey
Tera Contributor

Hi I have a  requirement to send a notification if the item changes to closed complete and a variable condition is met.

 

I have written this

 

(function executeRule(current, previous /*null when async*/ ) {

    // Add your code here

    var a = 'Afstemning@dsb.dk';
    gs.eventQueue('hr.Byttepenge.jeg.har.miset.mine', current,a);

})(current, previous);
1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@AbidJafrey 

why not directly send it from notification filter condition?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

7 REPLIES 7

VengadeshB52217
Tera Contributor

@AbidJafrey 

Hi , Can you describe your issue in detail

Abhishek_Thakur
Mega Sage

Hello @AbidJafrey ,

You need to create one business rule on the "sc_req_item" table and follow the below script.

var rec = new GlideRecord("sc_req_item");
rec.addQuery("sys_id", curren.sys_id);
rec.addEncodedQuery("state=3");
rec.query();
if (rec.next()) {
    if (a == "Afstemning@dsb.dk") {
        gs.eventQueue('hr.Byttepenge.jeg.har.miset.mine', current, a);
    }
}

 

Please mark my answer as accepted solution and give thumbs up, if it helps you.

Regards,

Abhishek Thakur

Community Alums
Not applicable

Hi,

 

You can directly configure a notification through the notification module. Make sure that you are giving the conditions correctly. E.g.: Stage/State changes to closed complete and select show variables > your variable details.

 

Regards,

Bhavani

Ankur Bawiskar
Tera Patron
Tera Patron

@AbidJafrey 

why not directly send it from notification filter condition?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader