Copy worknotes from IncidentTask to Incident
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2024 05:27 AM
Hi All,
I have below requirement.
Copy worknotes from IncidentTask to Incident.
I have write BR for this but BR is not working please let me know what is issue in my BR. (BR is on After Insert and Update)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2024 05:52 AM
Hi Jui,
current.incident will give you the sys_id of the incident. So, please update your code as below.
(function executeRule(current, previous /*null when async*/) {
// Add your code here
gs.log(current.incident+" "+current.work_notes);
var gr = new GlideRecord("incident");
gr.addQuery('sys_id',current.incident);
gr.query();
while(gr.next()){
gr.work_notes=current.work_notes.getJournalEntry(1);
gr.update();
}
})(current, previous);
If my answer has helped with your question, please mark my answer as accepted solution and give a thumbs up.
Best regards,
Tharun Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2024 05:56 AM
@jui Please use below code snippet:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2024 06:13 AM
Hi @jui ,
You need to write update BR [ after ] on Incident Task ( incident_task ) with condition on worknotes changes.
You need only one line of code in BR. Incident Task has parent column which hold the incident's sys_id so we dont need to again glide on incident table.
-Thanks,
AshishKM
Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution