Update the work notes whenever incident and problem table work notes is updated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Whenever a incident table's work notes are updated, I need the incident table's work notes to be updated. Whenever a problem table's work notes are updated, I need the incident table's work notes to be updated. How can we achieve this scenario?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @HarishBalaji11,
it can be achieved by a business rule or flow.
Important is to realise and tell us what shall that work note contain - will it be dynamically populated based on the update or will it always be something like "Incident was updated"...? For that provide more details, will it be applicable for EVERY update or rather just SOME?
Also, what's the reasoning for this? There's the activity section, that's not sufficient?
/* If my response wasn’t a total disaster ↙️ ⭐ drop a Kudos or Accept as Solution ✅ ↘️ Cheers! */
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I believe your question is not framed correctly.
Are you saying you want work_notes to be synced between incident and problem table?
If yes then check this link which talks about doing the sync between RITM and Catalog task and enhance the logic for your tables.
Note: Your script should avoid the loop as you are syncing work notes on both the records
Sync'ing RITM and SCTASK work notes \ additional comments -> response from Sravani44
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hope you are doing good.
Did my reply answer your question?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @HarishBalaji11 ,
By creating an onBefore Update or onAfter Update Business Rule on the Problem Task table, you can detect when the work_notes field is updated and populate that update to all related Incidents.
(function executeRule(current, previous /* null when async */) {
if (current.problem && current.work_notes.changes()) {
var incGr = new GlideRecord('incident');
incGr.addQuery('problem_id', current.problem);
incGr.query();
while (incGr.next()) {
incGr.work_notes = current.work_notes.getJournalEntry(1);
incGr.update();
}
}
})(current, previous);
If you found my response helpful, please mark it as ‘Accept as Solution’ and ‘Helpful’. This helps other community members find the right answer more easily and supports the community.
Kaushal Kumar Jha - ServiceNow Consultant - Lets connect on Linkedin: https://www.linkedin.com/in/kaushalkrjha/