worknotes not updating via business rule

ronaldanand
Tera Contributor

Hi All

When ever the User get inactive i want to update the incident worknotes please reassign the ticket to some one.

I used follwing business rule in SYS_USER table and AFTER / UPDATE condtion.

But i not able update the worknots. Please some one help me to fix this issue.

find_real_file.png

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

var rec=new GlideRecord('incident');
rec.addQuery('assigned_to',current.sys_id);
rec.addQuery('active',true);  
rec.addQuery('state','!=',6);   /
rec.query();
while(rec.next()){
     rec.assigned_to = '';
     rec.work_notes = "Manual Worknotes";
  rec.setWorkflow(false);  
  rec.autoSysFields(false);      rec.update();
 
}
   
})(current, previous);

1 ACCEPTED SOLUTION

Ashutosh Munot1
Kilo Patron
Kilo Patron

HI,

So when we write a setWorkflow(false) it will not update the journal entry table and audit tables. Because no business rule will run and then hence worknotes will not get updated in activity log and in respective tables.


Thanks,
Ashutosh

View solution in original post

9 REPLIES 9

Done .. But no luck

 

Have you tried with Before Business rule ? Why are you doing?

 rec.setWorkflow(false);  
 rec.autoSysFields(false)

Thank you,
Abhishek Gardade

This worked like charm!! rec['work_notes'].setJournalEntry("Manual Worknotes");

Ashutosh Munot1
Kilo Patron
Kilo Patron

HI,

So when we write a setWorkflow(false) it will not update the journal entry table and audit tables. Because no business rule will run and then hence worknotes will not get updated in activity log and in respective tables.


Thanks,
Ashutosh

ronaldanand
Tera Contributor

AFTER removing  

rec.setWorkflow(false);  
rec.autoSysFields(false);      this comments , its working fine

Thanks