How to Get SC Task Closed Date in Flow Designer Script Step

LokeshwarRV
Tera Contributor

Hi Community,

I'm working with Flow Designer and I have a flow triggered by an SC Task. I want to retrieve the closed_at date of that SC Task and use it in a Flow variable called revokeAccess.

// i am using this in my background script to get the closed date help me to get in my flow script

var taskGR = new GlideRecord('sc_task');
if (taskGR.get(fd_data.sys_id)) {
    var closedAt = new GlideDateTime(taskGR.closed_at);
    return closedAt.toString();
}
3 REPLIES 3

GlideFather
Tera Patron

Hi @LokeshwarRV 

 

you should do it via GlideRecord instead of GlideDateTime

———
/* If my response wasn’t a total disaster ↙️ drop a Kudos or Accept as Solution ↘️ Cheers! */


Ankur Bawiskar
Tera Patron
Tera Patron

@LokeshwarRV 

if the flow trigger is on sc_task you can directly access the closed_at field.

Why to use Flow variable?

IF you still require then

you can use "Set Flow Variables" flow logic and use script to set the value

something like this in the f(x) inline script

return fd_data.trigger.current.closed_at.toString();

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@LokeshwarRV 

Hope you are doing good.

Did my reply answer your question?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader