- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2023 10:22 PM - edited 03-13-2023 10:23 PM
Dear Team,
Want to auto-populate the work notes of Interaction's User's Tasks (incidents/requests) when work notes of its associated Interaction is updated/saved. (attached screenshot is the Interaction record's user's task records)
I tried to achieve this Before Insert Update BR on the Interaction table with the condition- Work notes changes, but not sure how to refer to Interaction's user's tasks records through advanced scripting so that when interaction work notes are updated then the same work notes will get auto-populated in its associated user's task records.
Please help to get this resolved.
Thanks in advance
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2023 12:57 AM
Working solution tried in Personal instance.
Few things to clarify is Related tasks vs User's Tasks
Related tasks is which interaction is associated with and User's tasks are like all active incidents, change, problem and requests opened by interaction open by user.
So I have script to update work notes to related records if you want I can send script for User's tasks also.
Bharath Chintala
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2023 01:50 AM
Thank you so much @OlaN Sir for all your time, I have learnt from this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2023 12:57 AM
Working solution tried in Personal instance.
Few things to clarify is Related tasks vs User's Tasks
Related tasks is which interaction is associated with and User's tasks are like all active incidents, change, problem and requests opened by interaction open by user.
So I have script to update work notes to related records if you want I can send script for User's tasks also.
Bharath Chintala
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2023 03:25 AM
Now the work notes copied when somebody make a new comment. What to do if I want to copy all existing work notes when associating an incident? (copy only first time when associating)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2023 01:46 AM
@BharathChintala its working fine for related records, thank you so much, marked accepted solution & helpful.
Yes sir that will be great if this is for user's task, please share desired BR for user's task.
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2023 03:27 AM
Create new business rule same before on Interaction table and same on insert and update work notes changes
(function executeRule(current, previous /*null when async*/ ) {
var callerID = current.opened_for;
if (JSUtil.notNil(callerID)) {
var inc = "active=true^caller_id=" + callerID;
var prb = "active=true^opened_by=" + callerID;
var chg = "active=true^requested_by=" + callerID;
var scr = "active=true^requested_for=" + callerID;
var incident = new GlideRecord('incident');
incident.addEncodedQuery(inc);
incident.query();
while (incident.next()) {
incident.work_notes = current.work_notes;
incident.update();
}
var change = new GlideRecord('change_request');
change.addEncodedQuery(chg);
change.query();
while (change.next()) {
change.work_notes = current.work_notes;
change.update();
}
var problem = new GlideRecord('problem');
problem.addEncodedQuery(prb);
problem.query();
while (problem.next()) {
problem.work_notes = current.work_notes;
problem.update();
}
var request = new GlideRecord('sc_request');
request.addEncodedQuery(scr);
request.query();
while (request.next()) {
request.work_notes = current.work_notes;
request.update();
}
}
})(current, previous);
Bharath Chintala