Workflow date compare issue

Hello Developer community,

I am trying to use a Compare Timestamps bloc in a workflow to make a comparison between the current date (-1 day) and a startdate (coming from an identity attribute)
Do you know how I can manage the variable $.now() (wich seems to return the current date on ISO 8601 format) to make that comparison in that bloc ?

1 Like

In Compare Timestamps operator, both the dates have to be in ISO8601 format for getting accurate results.

Hi Josquin,

Can you explain your use case? Are you trying to perform some action when a user has started? Why do you need to get the current date minus one day? This will help us better provide a solution for you.

Hi Colin,

i am working with Josquin ^^

Sorry for our late answer, we have needed to do some tests.

Our need : We want to do some actions when identities have their stardDate is equals or lower than today-1
For example the table of action if the today date is 2023/07/03 :
Identity startDate => Do actions on Identity
2023-07-01 => Do actions
2023-07-02 => Do actions
2023-07-03 => Do actions
2023-07-04 => Do actions
2023-07-05 => NO actions
2023-07-06 => NO actions

We have found the operator β€œCompare Timestamp” that can help us but we have some issues with this.



First issue :
When i select β€œMore Than or Exactly X Days Ago” i get the value β€œTimestampLessThanEqualsXDay”
When I select β€œFewer Than or Exactly X Days Ago” I get the value β€œTimestampGreaterThanEqualsXDay”
Already shown in this post : https://developer.sailpoint.com/discuss/t/compare-timestamps-operator-displaying-differently-than-expected-in-json/9532




Second Issue :
When I use β€œTimestampGreaterThanEqualsXDay”, the equals is not OK
Example with today date = 2023-07-03
Identity startDate => TimestampGreaterThanEqualsXDay with integer 0
2023-07-01 => KO
2023-07-02 => KO
2023-07-03 => KO (should be OK)
2023-07-04 => OK
2023-07-05 => OK

When I use β€œTimestampLessThanEqualsXDay”, the equals is OK
Example with today date = 2023-07-03
Identity => TimestampLessThanEqualsXDay with integer 0
2023-07-01 => OK
2023-07-02 => OK
2023-07-03 => OK
2023-07-04 => KO
2023-07-05 => KO




Third Issue :
When I use β€œTimestampLessThanEqualsXDay” with integer 1, it should answer my need but the results are weird :
Example with today date = 2023-07-03
Identity => TimestampLessThanEqualsXDay with integer 1
2023-07-01 => OK
2023-07-02 => OK
2023-07-03 => KO (should be OK)
2023-07-04 => KO (should be OK)
2023-07-05 => KO

1 Like

Given the outcome you are trying to achieve, you can use the following comparison.

If startDate is on or before today + 1 then do actions

startDate today (2023-07-03) + 1 is on or before?
2023-07-01 2023-07-04 yes
2023-07-02 2023-07-04 yes
2023-07-03 2023-07-04 yes
2023-07-04 2023-07-04 yes
2023-07-05 2023-07-04 no
2023-07-06 2023-07-04 no

In your Define Variable, configure it as follows:

In your Compare Timestamps, configure it as follows:

1 Like

Hi Colin,
thanks you very much for your answer, I will update my workflow and test that :heart_eyes:

I admit that I am a little affraid to use the Define Variable Block because I have seen β€œBeta” on it :rofl: :rofl:

I will inform you about the test result :wink:

2 Likes

Jean-Roland,

The beta tag is mainly because it is not where we want it to be for a goal UI/UX experience. The functionality works and was tested thoroughly. Some caveats apply such as chaining operations where you have date or number formatted values then want to chain a string manipulation. Those will not be supported until the goal experience meaning you will need to use multiple Define Variable operators.

Hi Thomas,
Thank you for the explanation, I better understand the meaning of β€œbeta” tags for Sailpoint components :wink:

Thank you @colin_mckibben for the proposed solution, it is responding perfectly to what we have wanted to do :grin:

4 posts were split to a new topic: Workflows: Subtract time in define variable

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