Created timestamp in transform

I am trying to create a new identity attribute in ISC using created timestamp and datecompare

{
    "name": "Test Date Compare",
    "type": "dateCompare",
    "attributes": {
        "firstDate": {
            "attributes": {
                "name": "created"
            },
            "type": "identityAttribute"
        },
        "secondDate": "now",
        "operator": "lt",
        "positiveCondition": "working",
        "negativeCondition": "not working"
    },
    "internal": false
}

Can someone please suggest, how do I achieve it.

I am getting below error

Error There was an exception while calculating the value for this attribute. null

Thanks

Hi @vaibhav_dubey_yancoal,

Try with this transform

{
  "name": ""Test Date Compare"",
  "type": "dateCompare",
  "attributes": {
    "firstDate": {
      "type": "identityAttribute",
      "attributes": {
        "name": "created"
      }
    },
    "secondDate": {
      "type": "dateFormat",
      "attributes": {
        "input": "now",
        "outputFormat": "ISO8601"
      }
    },
    "operator": "lt",
    "positiveCondition": {
      "type": "static", 
      "attributes": {
        "value": "working"
      }
    },
    "negativeCondition": {
      "type": "static",
      "attributes": {
        "value": "not working" 
      }
    }
  }
}

Hi @vaibhav_dubey_yancoal,

Assuming the created attribute is in ISO 8601 format, try this transform:

{
    "name": "Test Date Compare",
    "type": "dateCompare",
    "attributes": {
        "firstDate": {
            "attributes": {
                "values": [
                  {
                    "attributes": {
                
                        "name": "created"
                    },
                    "type": "identityAttribute"
                  },
                  "2999-01-01 00:00:00.000"
                ]
              },
              "type": "firstValid"
        },
        "secondDate": "now",
        "operator": "lt",
        "positiveCondition": "working",
        "negativeCondition": "not working"
    },
    "internal": false
}

If created is not in ISO format, make sure to convert into it before using in Date Compare, something like:

{
    "name": "Test Date Compare",
    "type": "dateCompare",
    "attributes": {
        "firstDate": {
            {
                "attributes": {
                  "input": {
                    "attributes": {
                        "values": [
                          {
                            "attributes": {                       
                               "name": "created"
                            },
                            "type": "identityAttribute"
                          },
                          "Some_Longer_Date_In_Created_Date_Format"
                        ]
                      },
                      "type": "firstValid"
                  },
                  "inputFormat": "Created_Date_Format",
                  "outputFormat": "ISO8601"
                },
                "type": "dateFormat"
            }
        },
        "secondDate": "now",
        "operator": "lt",
        "positiveCondition": "working",
        "negativeCondition": "not working"
    },
    "internal": false
}

Hi @vaibhav_dubey_yancoal ,

I think the problem is due to, there is no data found in Identity attribute “created”.

Try the below transform (added FirstValid for date and dateMath for calculating current date),

{
    "name": "Test Date Compare",
    "type": "dateCompare",
    "attributes": {
        "firstDate": {
            "attributes": {
                "input": {
                    "attributes": {
                        "values": [
                            {
                                "attributes": {
                                    "name": "created"
                                },
                                "type": "identityAttribute"
                            },
                            "5000-12-30T00:00:00"
                        ]
                    },
                    "type": "firstValid"
                },
                "inputFormat": "yyyy-MM-dd'T'HH:mm:ss",
                "outputFormat": "ISO8601"
            },
            "type": "dateFormat"
        },
        "secondDate": {
            "attributes": {
                "inputFormat": "yyyy-MM-dd'T'HH:mm'Z'",
                "outputFormat": "ISO8601",
                "input": {
                    "attributes": {
                        "expression": "now/d"
                    },
                    "type": "dateMath"
                }
            },
            "type": "dateFormat"
        },
        "operator": "lt",
        "positiveCondition": "working",
        "negativeCondition": "not working"
    },
    "internal": false
}

I think, this might help you. Thanks!!

1 Like

Hi @GOKUL_ANANTH_M @varshini303 @Arun-Kumar I am trying to use created timestamp from identity, screeshot for reference below.

If I use “firstValid” it always falls back to static value “5000-12-30T00:00:00”

Hi @vaibhav_dubey_yancoal ,
I want to understand the use case for which you are trying to do this…!!

are you trying to compare the “created” timestamp with now date, and deciding if the user is “working” or “not working” in organization ?

If yes then even if you get the transform right, you will always get user as “working”. So, I fail to understand the point of building this transform.

Could you please tell what is the use case and what exactly are you trying to solve/achieve ?

I can suggest you a way here, you can get the startDate of an identity using accountAttribute and can compare with the current date (now). By this way, you can achieve the employee is in working state or not.
(I will not suggest you to go with IdentityAttribute for this case, as IdentityAttribute creation is a multi-threaded process. As a best-practice, you can use accountAttributes, wherever if possible, when the identity enters into IDN via Auth. Source)

Created timestamp will give you the time and date, which the identity created in ISC.
If you have terminated the person too, it will show the created date.

And also, the above given suggestion selects only for prehire and active condition, not for inactive/terminated.

Thanks!!

Sorry, My bad… think of this as

        "positiveCondition": "abc",
        "negativeCondition": "xyz"

i.e. Working and not working were just placeholders

I am trying to create a transform where I can compare two dates

firstDate - identity created date
secondDate - an account attribute from a source

and based on this I populate this new attribute

I am aligning with this approach and planning to use “whenCreated” from AD

1 Like

Try using the same template, with your changes.

But I think on the first go, when an identity is created, this created attribute might not get any value I think so when this transform get executed. But on the second go, you can see the result.

Hi @GOKUL_ANANTH_M - so the fix would be to use “whenCreated” from AD and another account attribute from a different source and do a dateCompare

HI @GOKUL_ANANTH_M - Is there a way we can refer / use “created” timestamp in transforms

Understood,
I think you are not getting any value when you are using identityAttribute transform for getting “created” value,
I would check this with SailPoint Support and see what they suggest.

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