LDAP date conversion after doing a date math

I’m having a difficult time converting to a LDAP date. If you take the last conversion off, it works fine. My velocity script will need modified, but it shows how it was working with the ISO format. I need to send this date to LDAP only if it is available.

{
    "id": "720a951f-c037-4f6e-b5d0-b0b39fddefe9",
    "name": "LDAPDate",
    "type": "static",
    "attributes": {
        "ultiAccountExpires": {
            "attributes": {
                "input": {
                    "attributes": {
                        "input": {
                            "attributes": {
                                "input": {
                                    "attributes": {
                                        "values": [
                                            {
                                                "attributes": {
                                                    "attributeName": "ESTIMATED_END_DATE",
                                                    "sourceName": "UltiPro"
                                                },
                                                "type": "accountAttribute"
                                            },
                                            {
                                                "attributes": {
                                                    "value": "12/29/2099"
                                                },
                                                "type": "static"
                                            }
                                        ]
                                    },
                                    "type": "firstValid"
                                },
                                "inputFormat": "M/d/yyyy",
                                "outputFormat": "ISO8601"
                            },
                            "type": "dateFormat"
                        },
                        "expression": "+28h/h",
                        "roundUp": false
                    },
                    "type": "dateMath"
                },
                "inputFormat": "ISO8601",
                "outputFormat": "LDAP"
            },
            "type": "dateFormat"
        },
        "value": "#if($ultiAccountExpires != '2099-12-30T04:00Z')$ultiAccountExpires#end"
    },
    "internal": false
}

Hi,

Can you try this -

{
    "id": "720a951f-c037-4f6e-b5d0-b0b39fddefe9",
    "name": "LDAPDate",
    "type": "static",
    "attributes": {
        "ultiAccountExpires": {
            "attributes": {
                "input": {
                    "attributes": {
                        "input": {
                            "attributes": {
                                "input": {
                                    "attributes": {
                                        "values": [
                                            {
                                                "attributes": {
                                                    "attributeName": "ESTIMATED_END_DATE",
                                                    "sourceName": "UltiPro"
                                                },
                                                "type": "accountAttribute"
                                            },
                                            {
                                                "attributes": {
                                                    "value": "12/29/2099"
                                                },
                                                "type": "static"
                                            }
                                        ]
                                    },
                                    "type": "firstValid"
                                },
                                "inputFormat": "M/d/yyyy",
                                "outputFormat": "ISO8601"
                            },
                            "type": "dateFormat"
                        },
                        "expression": "+28h/h",
                        "roundUp": false
                    },
                    "type": "dateMath"
                },
                "inputFormat": "yyyy-MM-dd'T'HH:mm",
                "outputFormat": "LDAP"
            },
            "type": "dateFormat"
        },
        "value": "#if($ultiAccountExpires != '2099-12-30T04:00Z')$ultiAccountExpires#end"
    },
    "internal": false
}
1 Like

Hi @ts_fpatterson,
I had encountered a similar issue in my configurations, not with LDAP specifically but let me tell you what solved me.

Instead of directly converting the date from source “Ultipro”, can you try fetching the date as it is in an identity attribute and then use that identity attribute to convert date into ISO format ?

It sounds strange, but it worked for me, i fetched the “startDate” in an identity attribute “startDate1” and applied Date transforms on that identity attribute “startDate1” and it solved the date conversion/datemath issue for me.

Hope this helps.

Thanks,
Vaibhav

Hi @ts_fpatterson
So the issue is once you do the dateMath operation, the value is no more in the ISO8601 format, but changes to yyyy-MM-dd'T'HH:mm only.

Reference this document: Date Math | SailPoint Developer Community

Now, in order to convert to LDAP format, you have to change the input format from ISO8601 to yyyy-MM-dd'T'HH:mm

Next, you only want to populate fi the date is present on the Source, so to tackle that you can create a variable where you check if the date is coming from source or not to handle that situation.

P.S the below attached transform that handles both the issues.

{
    "id": "1257bbad-4d6d-4382-8562-fc13c14181be",
    "name": "LDAPDate",
    "type": "static",
    "attributes": {
        "dateExists": {
            "attributes": {
                "values": [
                    {
                        "attributes": {
                            "attributeName": "ESTIMATED_END_DATE",
                            "sourceName": "UltiPro"
                        },
                        "type": "accountAttribute"
                    },
                    "N/A"
                ]
            },
            "type": "firstValid"
        },
        "ultiAccountExpires": {
            "type": "dateFormat",
            "attributes": {
                "input": {
                    "type": "dateMath",
                    "attributes": {
                        "expression": "+28h/h",
                        "roundUp": false,
                        "input": {
                            "type": "dateFormat",
                            "attributes": {
                                "input": {
                                    "type": "firstValid",
                                    "attributes": {
                                        "values": [
                                            {
                                                "attributes": {
                                                    "attributeName": "ESTIMATED_END_DATE",
                                                    "sourceName": "UltiPro"
                                                },
                                                "type": "accountAttribute"
                                            },
                                            {
                                                "attributes": {
                                                    "value": "12/29/2099"
                                                },
                                                "type": "static"
                                            }
                                        ]
                                    }   
                                },
                                "inputFormat": "MM/dd/yyyy",
                                "outputFormat": "ISO8601"
                            }
                        }
                    }
                }, 
                "inputFormat": "yyyy-MM-dd'T'hh:mm", //the converted date will not be exactly ISO
                "outputFormat": "LDAP"
            }
        },
        "value": "#if(!$dateExists.equalsIgnoreCase('N/A'))$ultiAccountExpires#end"
    },
    "internal": false
}

Hope this helps…

1 Like

I needed to handle it further, unless I’m not understanding the LDAP format. It was not in the format of 20250101040000Z, so I modified the VT to be :

 "value": "#if(!$dateExists.equalsIgnoreCase('N/A'))$ultiAccountExpires.substring(0,14)Z#end"

This way I didn’t have to handle the plus sign or the .000 on the end. I didn’t test this the prior logic with my LDAP as I traditionally update it via LDIF using the format: 20250101040000Z

1 Like

I had considered this but was concerned about any last moment changes from HR, where I would be contending to get the LDAP written when the agrégation of HR happened,

thanks, this got me a step further than I was and was the main issue.

You may wonder why I needed to do the split.

This was because the LDAP we are writing to is the NetIQ eDirectory LDAP. I did some further researched and found the below information:

NetIQ eDirectory uses the LDAP Generalized Time format for date-time values, which follows the format YYYYMMDDHHmmSSZ. This format is compliant with the LDAP standard and ensures interoperability across various systems.

From the information available in the NetIQ eDirectory documentation, it is clear that the supported date format is strictly the Generalized Time format without any additional characters or time zone offsets like .+0000. The correct format would be 20250101040000Z for January 1, 2025, at 04:00:00 UTC.

For more detailed information on configuring and using Generalized Time in NetIQ eDirectory, you can refer to the following sources:

These guides provide comprehensive details on LDAP configurations and the supported formats for various attributes in NetIQ eDirectory.

I didn’t try setting the destination format to: YYYYMMDDHHmmSSZ. This may also work, and avoid the split logic on the Velocity Script.

2 Likes