- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2023 04:32 AM
Hi, ServiceNow Community,
I want to run a Business Rule Script when I press the 'Post' button on the work notes or additional comments.
It is possible somehow?
Business Rule conditions:
This When to Run conditions only works if I press save button or submit.
Best Regards,
Tiago Pinto
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2023 05:55 AM
When you press POST, you are actually saving a new record on the sys_journal_field table.
Business rules run on the server side so that is the table you would have to use for what you are trying to do but be careful with this table since it will be rather large.
This is an example script to look for the first comment
var notesGR = new GlideRecord("sys_journal_field");
notesGR.addQuery('name', 'incident'); //looking just for comments on the incident table
notesGR.addQuery('element_id', current.sys_id);
notesGR.addQuery('element', 'comments');
notesGR.orderBy('sys_created_on'); //first comment
notesGR.query();
If I helped you with your case, please click the Thumb Icon and mark as Correct.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2023 05:55 AM
When you press POST, you are actually saving a new record on the sys_journal_field table.
Business rules run on the server side so that is the table you would have to use for what you are trying to do but be careful with this table since it will be rather large.
This is an example script to look for the first comment
var notesGR = new GlideRecord("sys_journal_field");
notesGR.addQuery('name', 'incident'); //looking just for comments on the incident table
notesGR.addQuery('element_id', current.sys_id);
notesGR.addQuery('element', 'comments');
notesGR.orderBy('sys_created_on'); //first comment
notesGR.query();
If I helped you with your case, please click the Thumb Icon and mark as Correct.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2023 08:08 AM
Thank you @Sebas Di Loreto
It worked!