- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2023 01:37 PM
Hello ServiceNow Community,
I'm working on a business rule intended to transfer information from a standard CALL ticket, which is what our HelpDesk uses to field all first-contact interactions to another custom task table. However, I'm encountering challenges in getting it to function as expected. I'm hoping to get some guidance or suggestions from the community.
Objective: The goal is to transfer specific fields (like caller details, work notes, comments, etc.) from a CALL ticket to a newly created CBO ticket when a choice is selected in the CALL ticket. My current approach looks something like this:
if (current.description == "") {
gs.addErrorMessage("Description cannot be left blank. Please enter ALL relevant details into the description field. This ticket's history will not be transferred to the new CBO Incident.");
}
else {
var gr = new GlideRecord('u_cbo_incident');
gr.initialize();
gr.caller_id = current.caller_id;
gr.u_parent_call = current.sys_id;
gr.location = current.u_location;
gr.u_alternate_phone = current.u_alternate_phone;
gr.u_alternate_email = current.u_alternate_email;
gr.comments = current.comments.getJournalEntry(-1);
gr.work_notes = current.work_notes.getJournalEntry(-1);
gr.short_description = current.short_description;
gr.description = current.description.getHTMLValue();
var newCboSysId = gr.insert();
new GlideSysAttachment().copy('Incident', current.sys_id, 'u_cbo_incident', newCboSysId);
current.comments = "ITS ticket closed, and transferred to CBO: " + gr.number;
current.state = '7'; // Assuming '7' is the closed state
current.close_code = "cbo_inc";
current.update();
action.setRedirectURL(gr.getLink());
}
But this isn't working as I expect it to, mainly the fields aren't being copied over, like "current.caller" I'm wondering a couple of things here: Am I approaching this the wrong way? Is there a simpler way to accomplish this? Any advice on this topic, or helpful hints where to learn more about this type of task would be very much appreciated.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2023 05:29 PM
Is this a Before BR? You shouldnt be using current.update()
all the fields aren’t being copied or just some of the fields?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2023 04:14 PM
Hi @crstaples ,
As first two fields are reference type , you can try with .getDisplayValue();
gr.caller_id = current.caller_id.getDisplayValue();
gr.u_parent_call = current.sys_id.getDisplayValue();
-Thanks
Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2023 05:29 PM
Is this a Before BR? You shouldnt be using current.update()
all the fields aren’t being copied or just some of the fields?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2023 08:11 AM
Most of the fields aren't being correctly copied. The one that appears to be is the description field.