- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-03-2017 03:23 AM
Hi everyone,
I have a requirement where I have run a fix script to set the state of Risk records that has #closed tag. This table has an email notification set up which will be triggered if the record is closed.
As this is an adhoc process, I need to ensure that the notification is not triggered once I run the Fix Script.
Is there a way to accomplish this without de-activating the notification?
Thanks
Regina
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-03-2017 03:27 AM
Hi Regina,
If the emails are triggered via event, from a business rule. then can you use setWorkflow(false) in your fix script which will not let the BRs to run and hence no email.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-04-2017 05:55 AM
Thanks Chuck, it does the same thing. But good thing that came out of this exercise is that I was able to explore Script Action which I haven't used before. Thank you so much for your help as always. Have a good day!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-04-2017 06:01 AM
That's odd. I wonder if the events are being processed in a different order than they are being queued. I would hope it is a FIFO (first in first out), but don't know the event queue management to that detail unfortunately. Sorry that didn't work out. I'll let you know if I come up with any other ideas.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-04-2017 05:56 AM
Thanks Anurag I've tried this and it worked great.
One thing to note though is that setting workflow to false will disable auditing so I had to set it to true after closing out the status to add the work notes to the audit log.
var riskRec = new GlideRecord('u_risk');
//proces risk records
- riskRec.addEncodedQuery('u_tagLIKE#close^state!=Closed');
- riskRec.query();
while(riskRec.next()) {
gs.log('processing sysid-' + riskRec.sys_id);
riskRec.state = 'Closed';
//set workflow to false to disable BR
riskRec.setWorkflow(false);
riskRec.update();
//need to set the workflow to true to add the work notes to the audit log
riskRec.setWorkflow(true);
riskRec.u_work_notes = 'Risk automatically closed according to its heritage risk register state'
riskRec.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-04-2017 06:10 AM
Yes Regina,
This is a pickle we land in a lot of times, if you setWorkflow false then the journal fields don't get updated.