Transform to check value

Hi everyone,

I’m working with a multi-valued account attribute that stores values in the following format:
{“@odata.type”:“type text”,“id”:“123456”,“displayName”:“name of the device”}

For some users, this attribute may be empty or not populated at all.

Requirement:
I need to create an identity attribute that stores the value “Y” if the account attribute contains any value, and “N” if it is empty or null.

What I’ve Tried:
I attempted both static and conditional transforms to evaluate the presence of a value in the account attribute and set the identity attribute accordingly. While the static condition works when the account attribute has a value (setting it to “Y”), it throws a processing error when the attribute is empty.

Has anyone encountered a similar scenario? I’d appreciate any suggestions or best practices to handle this condition gracefully.

Thanks in advance!

{
    "name": "isMFACapable",
    "type": "static",
    "attributes": {
        "mfacapable": {
            "attributes": {
                "values": [
                    {
                        "attributes": {
                            "attributeName": "Attribute Name",
                            "sourceName": "Soure Name"
                        },
                        "type": "accountAttribute"
                    }
                ]
            }
        },
        "value": "#if($mfacapable != null && !$mfacapable.toString().trim().isEmpty()) Y #else N #end"
    }
}

{
  "name": "isMFACapable1",
  "type": "conditional",
  "attributes": {
    "test": {
      "type": "accountAttribute",
      "attributes": {
        "sourceName":"Source Name",
        "attributeName": "Attribute Name"
      }
    },
    "operator": "notNull",
    "true": {
      "type": "static",
      "attributes": {
        "value": "Y"
      }
    },
    "false": {
      "type": "static",
      "attributes": {
        "value": "N"
      }
    }
  }
}

Hello @ag2024 , you can try below transform -

{
    "name": "Test Static",
    "type": "static",
    "attributes": {
        "isMFACapable": {
            "type": "firstValid",
            "attributes": {
                "values": [
                    {
                        "type": "accountAttribute",
                        "attributes": {
                            "sourceName": "",
                            "attributeName": ""
                        }
                    },
                    "emptyValue"
                ],
                "ignoreErrors": false
            }
        },
         "value": "#if($isMFACapable=='emptyValue')N#{else}Y#end"
    },
    "internal": false
}

Thanks,
IAM_PDU

1 Like

Thank you @IAMpdu for your help. It’s now working as expected!

Could you please share the documentation path where I can find more details about the transformation configuration? Specifically, I noticed you used the emptyValue and ignoreErrors properties in the transform, but I couldn’t locate any reference to these in the official Microsoft documentation.

Thanks in advance for your help!

Hello @ag2024 ,
“emptyValue” is just a static string you can replace it with anything. You dont need “ignoreErrors” as wll.

1 Like

The documentation for the firstValid transform primitive is here: First Valid | SailPoint Developer Community

I would suggest setting ignoreErrors to true so that the transform properly rolls over to emptyValue if the accountAttribute transform fails for any reason.

1 Like