Substring Transform error

I am using a substring transform to clean up date string for account expires. Everything works as its pretty simple until that remove the date and mark it as “never” which is now short 5 char from the 10. does anyone have a way to fix this error that when the word “never” shows up that it will change it to this and not error.

undefined

{
    "id": "",
    "name": "DateReformat_substrYYYYMMDD",
    "type": "substring",
    "attributes": {
        "ignoreErrors": "true",
        "begin": 0,
        "end": 10
    },
    "internal": false
}

image

goes from month/day/year to Never. and just need to get that ability to change without error when that happens

@VBsupport can you share the transform you are using?

Regards,
Shekhar Das

@VBsupport , you can use static operation to handle the error by checking if attribute value is never else update using substring value.

1 Like

@VBsupport try this out

{
    "type": "static",
    "attributes": {
        "isAccountExpire":
            {
                "type": "firstValid",
                "attributes": {
                    "values": [
                        {
                            "type": "accountAttribute",
                            "attributes": {
                                "sourceName": "Active Directory",
                                "attributeName": "accountExpire"
                            }
                        },
                        "none"
                    ],
                    "ignoreErrors": false
                },
                "formattedAccountExpire": {
                    "type": "dateFormat",
                    "attributes": {
                        "inputFormat": "<give the input format>",
                        "outputFormat": "<give the output format as you desire>",
                        "input": {
                            "type": "accountAttribute",
                            "attributes": {
                                "sourceName": "Active Directory",
                                "attributeName": "accountExpire"
                            }
                        }
                    }
                }
            },
        "value": "#if($isAccountExpire == 'none' || $isAccountExpire == 'never')#{else}$formattedAccountExpire#end"
    },
    "name": "Transform_accountExpire"
}

For input and output date please refer below:
Date Format | SailPoint Developer Community

Regards,
Shekhar Das

2 Likes

Or even something like this:

{
  "name": "DateReformat_substrYYYYMMDD",
  "type": "firstValid",
  "attributes": {
    "values": [
      {
        "type": "static",
        "attributes": {
          "value": "#if($isAccountExpire == 'none' || $isAccountExpire == 'never')$isAccountExpire#{else}$formattedAccountExpire#end",
          "isAccountExpire": {
            "type": "firstValid",
            "attributes": {
              "values": [
                {
                  "type": "accountAttribute",
                  "attributes": {
                    "sourceName": "Active Directory",
                    "attributeName": "accountExpire"
                  }
                },
                "none"
              ],
              "ignoreErrors": false
            }
          },
          "formattedAccountExpire": {
            "type": "static",
            "attributes": {
              "type": "substring",
              "attributes": {
                "input": {
                  "type": "accountAttribute",
                  "attributes": {
                    "sourceName": "Active Directory",
                    "attributeName": "accountExpire"
                  }
                },
                "begin": 0,
                "end": 10
              }
            }
          }
        }
      },
      "Error"
    ],
    "ignoreErrors": false
  }
}
1 Like