- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2023 06:08 AM
Hi Community,
I have a requirement where Virtual agent is going to create a incident with some attachments attached. As I am able to do attachment but in the work notes is showing as updated by caller . I want to change the work notes updated by to "system" instead of caller. How we can change updated by to System for work notes in VA?
Thanks in advance.
Thanks,
Pooja M
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2023 07:10 AM
Hi Riya,
Thank you so much for the reply. The above answer gave me some hint to solve my issue .
But the below link helped me to solve my complete issue.
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0748347
Thanks,
Pooja M
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2023 06:56 AM
Hi @Pooja Mallikarj ,
Hope you are doing great.
To achieve the desired behavior of having the Virtual Agent (VA) create an incident with attachments while updating the work notes with "System" instead of "Caller," we can implement the following technical solution:
Create a dedicated script or business rule to handle the incident creation and attachment process from the Virtual Agent.
In the script or business rule, ensure that the work notes field is explicitly set to "System" as the updated by value before updating the work notes content.
// Sample code for incident creation and attachment handling in ServiceNow
var caller = gs.getUser(); // Assuming this variable holds the user making the request (Virtual Agent in this case)
var incident = new GlideRecord('incident');
incident.initialize(); // Initialize a new incident record
// Set incident properties here (e.g., short_description, description, etc.)
incident.short_description = 'Incident created via Virtual Agent';
incident.description = 'Incident details provided by Virtual Agent';
// Attachments handling
// Assuming you have the attachment details available, use the following code to attach them to the incident.
// Replace 'attachment_sys_id' with the actual sys_id of the attachment record in ServiceNow.
var attachment_sys_id = 'attachment_sys_id';
var attachment = new GlideSysAttachment();
attachment.write(incident, 'incident', attachment_sys_id);
// Update the work notes field with 'System' as the updated by value.
incident.work_notes = 'Your work notes content here';
incident.work_notes.setJournalEntry(true);
incident.work_notes.updated_by = 'System'; // Setting the 'updated_by' value to 'System'
// Save the incident record
incident.insert();
Regards,
Riya Verma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2023 07:10 AM
Hi Riya,
Thank you so much for the reply. The above answer gave me some hint to solve my issue .
But the below link helped me to solve my complete issue.
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0748347
Thanks,
Pooja M
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2023 09:59 AM
Thanks @Pooja Mallikarj for your inputs, and providing link which provides add on details to help you out in scenario. Can you please accept the solution so that it can help other out in building and getting inputs from community.
Thanks in advance.
Regards,
Riya Verma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2023 07:02 AM
Thank you Riya.