Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Retrieving Current Date in Flow Designer

Dan13
Tera Expert

I am trying to retrieve the current date within a flow so I can do a check to see if the current date is on or after a specific date defined by the user during ticket submission. I found a post from a couple years ago that is marked as a correct answer. It describes creating a custom action and gives the script for retrieving the current date. Problem is, I have never created one myself and the action I created is not returning what I need. Here's what I have:

find_real_file.png

I set up a step in the flow to send an email with the output value to see if it was working and got this:

find_real_file.png

Seems to imply a blank return on the variable.  Here is the flow I created and the If logic I set up

find_real_file.png

find_real_file.png

find_real_file.png

Here is what the action returns

find_real_file.png

 

I'm guessing that I'm missing an input or output but I'm not sure exactly where my issue is. Or maybe I don't even need a custom action and can do this in an easier way?

1 ACCEPTED SOLUTION

I ended up figuring out what was wrong. I updated the script to create a variable and set that variable to the current date. Then I set the outputs to that variables value.

find_real_file.png

View solution in original post

5 REPLIES 5

Prasad Pagar
Mega Sage

Hi @Dan

I dont see 'result' as output variable here

find_real_file.png

Also can you please show me what you have in Get Current Date Action

find_real_file.png

 

Thank you
Prasad

Thanks! I was thinking that was the final output of the action. Added the output variable

find_real_file.png

And added it to the outputs
find_real_file.png

 

Here is what shows on the flow

find_real_file.png

Hi @Dan

Glad that you find it helpful.

Did my reply answer your question?

If so, can you please mark response as correct for others who may have a similar question in the future.

If not, please let us know if you need any other help

Thank you and Stay safe
Prasad

It got me a bit further. I now actually get an output

find_real_file.png

Updated the script step to look like this

find_real_file.png

Output is this

find_real_file.png

Any thoughts?