Adding comments with setWorkflow(false)

Dubz
Mega Sage

Hi All,

I'm trying to add comments to a task form without them triggering a notification but if i use setWorkflow(false) it doesn't run the necessary rules to link the sys_journal_field record to the task form with the requisite sys_audit and sys_history_line records.

Does anyone know of a way to do this?

Cheers

Dave

1 ACCEPTED SOLUTION

Dubz
Mega Sage

Ended up just adding an advanced condition into the incident updated for ess notification to suppress the notification when it sees a string value i'm adding into the comment when i add the email body.

Documented the whole thing as below just in case anyone else is interested.

https://community.servicenow.com/community?id=community_article&sys_id=44ce5c051b718810a59033f2cd4bc...

View solution in original post

16 REPLIES 16

asifnoor
Kilo Patron

Hi,

One quick fix is to disable notifications and run your script and then enable it again.

Or instead of disabling notification, redirect all notification to some test email address in email properties. Run your script and then remove this.

Mark the comment as a correct answer and helpful if this helps.

I'm adding content sent from the email client so that it shows up in additional comments, this isn't a one-off update, it'll be running continuously.

Ah okay. So notification is being triggered as it is considering an update wheneve you add an comment.

If that is the case, can you able to differentiate the comment that you add with the other comments? IF yes, you can add that as a condition in your notification to not trigger if update is to comments and the comments content is "".

Yeah i was hoping for something a bit cleaner that looking for string values in the comment or making changes to hidden checkbox fields etc.