Any way to disable creating work notes when running a scheduled job?

Digit
Kilo Guru

Use Case: I have a scheduled job that updates duration fields every 12 hours.

  • I don't want the scheduled job to create work notes, (because everyone would get notified too often, and it would clutter the notes tab).
  • I do have the duration fields checked in the Activity formatter because I do want a work note created when someone manually changes the value from the form.
  • I need to business rules to run when the job runs (so setWorkFlow probably won't work for this situation)

So basically: How can I prevent a scheduled job from creating work notes, but also create work notes when the field(s) are manually updated?

1 ACCEPTED SOLUTION

Digit
Kilo Guru

That was very helpful, @Arun_S1 , but it didn't quite work for me. 

My solution:

  1. I removed the duration fields from the Activity Formatter on the form, which prevented the scheduled job to create work notes when it executed. 
  2. Then I used your suggestion of creating a business rule to create a work note when a user manually made the change:

 

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

        var user = gs.getUserDisplayName().toString();
        current.work_notes = user + " updated the Blocked Duration from " + previous.u_blocked_duration.getDisplayValue() + " to " + current.u_blocked_duration.getDisplayValue();

})(current, previous);​

Worked like a charm. Thanks again for the assistance!!

 

View solution in original post

5 REPLIES 5

Digit
Kilo Guru

That was very helpful, @Arun_S1 , but it didn't quite work for me. 

My solution:

  1. I removed the duration fields from the Activity Formatter on the form, which prevented the scheduled job to create work notes when it executed. 
  2. Then I used your suggestion of creating a business rule to create a work note when a user manually made the change:

 

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

        var user = gs.getUserDisplayName().toString();
        current.work_notes = user + " updated the Blocked Duration from " + previous.u_blocked_duration.getDisplayValue() + " to " + current.u_blocked_duration.getDisplayValue();

})(current, previous);​

Worked like a charm. Thanks again for the assistance!!