Is there a way to use now in Workflow compare timestamp?

Is it possible to use now for use in the ‘Compare Timestamp’ operator in ISC Workflows? I want to filter actions taken based on when the workflow is triggered relative to today and have so far been unable to use ‘now’ as a comparison. Is this possible?

Hi @dominick-miller,
You can get the current date in a workflow by using a “Define Variable” operator and the expression $.now().

Then you can use this date in a “Compare Timestamp” operator.

Let me know if this resolve your issue.

Regards,
Mathieu

Hi @mathieug ,

This is promising but I think I am missing context on how to use defineVariable exactly. My Define Variable config screen looks different than the screenshot you provided, as well. For example, I have a Basic/Advanced screen option. Within advanced, I have this JSON:

{
“name”: “today”,
“description”: “”,
“transforms”: [ ],
“variableA”: “$.now()”
}

and it does not seem to work. Do you know how my formatting is incorrect here?

Hi @dominick-miller,

Try this.

You can also take a look at the below thread for reference

2 Likes

@jesvin90 provided the right screenshot. You have to select “Basic”, then “Attribute” and write the correct expression $.now().

Regards,
Mathieu

Thank you both. It turns out that I was using the $.now() correctly within defineVariable, but for some reason my date comparison operator is not working as I expect. I will have to debug that, but I appreciate the help on this.

@dominick-miller Were you able to get the ‘Compare Timestamps’ operator to work. I am facing an issue what every date I compare with using which ever comparison operator available it always returns empty {} and end up as a false.

Hi Manju,

I also experienced some strange issues with the ‘Compare Timestamps’ operator. As mentioned above, I initially thought it was an issue with how I was defining $.now() but it ended up being a ‘Compare Timestamps’ bug. After a certain amount of time and refreshing my browser window, the comparison operator began working with no changes on my side. I wish I had a better explanation for you, but try refreshing your browser or provide more details to how you have your operator set up so I can try to assist.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.