- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-28-2022 03:53 AM
Hi all
Am stuck on what I think should be an easy task but it's had me pulling my hair out so looking for some assistance.
I have been working on a VA topic that allows users to chase or escalate a ticket. Part of the requirements for this is to have custom fields on the incident form for Escalated (true/false) and Escalated On (date/time).
In my topic flow I have been able to use a Record Action block to get the Escalated field to show as true, but am struggling to do the same for the date/time field.
What I am struggling to do is to create a script variable that can be referenced in the Record Action block. I've tried to create a variable and set the value to be gs.nowDateTime() but this variable is not selectable in the Record Action block.
I'm fairly new to scripting for VA (and in general) so am hoping that someone can point me in the right direction.
Thanks
Solved! Go to Solution.
- Labels:
-
Virtual Agent
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-28-2022 05:56 AM
Hi,
you can use Script variable which can hold value
Then use that as input
Store the current date/time using this
new GlideDateTime()
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-28-2022 04:53 AM
Hi,
Can you share relevant scripts and screenshots?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-28-2022 05:07 AM
Of course, thanks for the prompt!
There are several scripts in the flow but this is the one where I have added the variable to get the date/time:
(function execute() {
var gr = new GlideRecordSecure(vaVars.table_name);
if (gr.get(vaVars.sys_id)) {
var comment = vaInputs.additional_information.getValue().trim();
var escaltedOn = gs.nowDateTime();
var priority = vaInputs.priority.getValue();
gr.comments = 'The user has indicated this as a ' + priority + ' and added the following information: ' + '\n' + '\n' + comment;
gs.eventQueue("x_mlg_mclaren_itsm.VA.Ticket.Escalation", gr,'' ,'' );
gr.update();
}
})()
Below this is a Lookup block to get ticket info:
And then the Record Action block that assigns the True value to the Escalation true/false field on the incident record.
The section of the flow looks like this:
The overall flow is as follows:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-28-2022 05:56 AM
Hi,
you can use Script variable which can hold value
Then use that as input
Store the current date/time using this
new GlideDateTime()
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-28-2022 05:45 AM
HI,
You can get this done via "record action" component.
Script Variable: create a script variable and click the code section to return the datetime as you did.
use record action to link the datetime field from inc to this script variable as below.
then you can see the record is updated once