- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2018 06:39 AM
Hi Raj,
Instead of using current.update in both insert and update BR, please query the incident table and update the due date field.
Never use current.update in a Business Rule
You can try the below script.
(function executeRule(current, previous /*null when async*/) {
var sla = new GlideRecord('task_sla');
sla.addQuery('task', current.getUniqueValue());
sla.addQuery('active',"true");
sla.addQuery('sla.u_fixed', "true");
sla.orderByDesc('planned_end_time');
sla.query();
if(sla.next())
{
var inc = new GlideRecord('incident');
inc.get('sys_id',current.sys_id);
inc.due_date= sla.planned_end_time;
inc.autoSysFields(false);
inc.setWorkflow(false);
inc.update();
}
})(current, previous);
I was wondering why do you have two different BR while you can do both operations in one itself.
Thanks
Gaurav
PS: Please mark the response correct/helpful based on the impact.