cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

IdentityNow Transforms - Static

IdentityNow Transforms - Static

The transform documentation listed here is outdated and is nonger actively maintained. Please refer to https://developer.sailpoint.com/idn/docs/transforms for IdentityNow Transform documentation.

Labels (1)
Tags (1)
Comments

Hi,

If the input specified for the attribute is null, then we see that IdentityNow fails to render the static expression. It keeps throwing error "Error rendering template:".

For instance in example 2, if empType is null, then the transform fails with the above said error.

Thanks,

VK.

Hey @venkateshkan you are absolutely right. What I have done to get around this and to ensure that there are no errors is utilizing the firstValid transform with this. See my example below:

 

{
    "attributes": {
        "workerType": {
            "attributes": {
                "values": [
                    {
                        "attributes": {
                            "sourceName": "HR Source",
                            "attributeName": "empType"
                        },
                        "type": "accountAttribute"
                    },
                    "null"
                ]
            },
            "type": "firstValid"
        },
        "value": "#if($workerType==\"Employee\")Full-Time#{else}Contingent#end"
    },
    "type": "static",
    "name": "Test_Static_Transform_with_firstValid"
}

 

As you can see with this method, if the accountAttribute value is null, then the next valid value will be the string "null" or whatever you set as the last valid value. This will make sure you don't get any errors.

This also comes in handy when defining the conditional statement for the value of the static transform. I often write these statements starting with the null argument, as seen below:

"value": "#if($workerType!=\"null\")$workerType#{else}Contingent#end"

In addition to my reply above, I wanted to provide some helpful tips that I have learned over time while utilizing static transforms, as the static transform is incredibly useful for some more conditional and complex logic.

 

Operators:

Equals

==

Example:

#if($variableOne==\"True\")True#{else}False#end

 

Does not Equal

!=

Example:

#if($variableOne!=\"True\")Not True#{else}True#end

 

And

&&

Example:

#if($variableOne!=\"null\" && $variableOne==\"True\")True#{else}False#end

 

Or

|| (two pipes)

Example:

#if($variableOne==\"null\" || $variableOne==\"False\")False#{else}True#end

 

Another tip I would mention is that you can use else-if statements with static transforms as well.  I have used fairly extensive if/else-if statements, and a few examples are below:

"value": "#if($newEmail==\"null@emaildomain.com\")none#elseif($ADEmail==\"null\" || $ADEmail==\"none\")$newEmail#{else}$ADEmail#end"

"value": "#if($firstName!=\"Null\" && $lastName!=\"Null\")$firstName $lastName#{else}NO NAME GENERATED#end"

"value": "#if($userStatus!=\"active\" && $userStatus!=\"null\")$disabledOU#elseif($deptOU!=\"null\")$deptOU#{else}#end"

"value": "#if($userStatus==\"active\" || $userStatus==\"null\")$userDepartment#elseif($userStatus==\"loa\" || $userStatus==\"litigationhold\")$LOAorLHDescription#{else}$disableDescription#end"

 

In terms of operators, I don't know if there is an operator for "contains" or "like," but if anyone else knows how that would work, please let me know; I would love to learn!

I believe any of the StringUtils classes should work, including "contains". For example: 

#if($search.contains("google"))google#{else}nothing#end

 

@justinrhaines that's awesome! Thanks for the response; I'll give this a try.

@Brennen Thank you for your response and the information you provided is very much handy for someone starting with these transforms. 

We did the same workaround of using firstvalid transforms to circumvent this issue. 

Regards,

VK.

May be a stupid question, but how does one return a true null out of a firstValid?  (Not a string "null").  I.e., after the transform if nothing worked I want the identity attribute to be null.

Hey @rkunditch,

The method I have used is in the "value" attribute/statement logic, where you define the actual value to use depending on the conditions defined. If I want a "true null" value, I just leave the "then" statement empty, such as:

"value": "#if($testValue==\"TRUE\")TRUE#{else}#end"

This will return a null or "(empty)" value.

Another method is to actually define a null variable, such as:

{
    "name": "BTS_Test_Static",
    "type": "static",
    "attributes": {
        "fn": {
            "attributes": {
                "name": "firstname"
            },
            "type": "identityAttribute"
        },
        "null": {
            "attributes": {
                "value": ""
            },
            "type": "static"
        },
        "value": "#if($fn==\"Jason\")TRUE#{else}$null#end"
    }
}

 

One issue that I see with this, however, is that the attribute value still shows up in the Identity Attributes list, despite having no content. I wish there was a way to hide the attribute from the Identity Attributes list if the value is null... maybe there is a way to do this and I just don't know about it yet.

Also @rkunditch, the Transform Operations documentation on Compass is being removed here soon, as it has been moved to the Developer Docs page. You can access it here:

https://developer.sailpoint.com/idn/docs/transforms/operations

Thanks @Brennen 

@Brennen One way of checking for a "contains" or "does not contains" operation is to use the Index Of. I have used this multiple times. For example,

"indexcn": {
                "attributes": {
                    "input": {
                        "attributes": {
                            "name""firstname"
                        },
                        "type""identityAttribute"
                    },
                    "substring""Test"
                },
                "type""indexOf"
            }
 
And then use, #if($indexcn == (-1))
 
If the substring being searched for is not found, the transform returns -1

@hari_patel Which Apache Velocity Tools we can use in the static transform ? 

I tried the method of feeding the null value through the else statement, but it is not working for me.  Does anyone have any other ideas to feed a null value to an identity attribute?

"value": "#if($fn==\"Jason\")TRUE#{else}$null#end"
 
 

null_error.PNG

Version history
Revision #:
4 of 4
Last update:
‎May 01, 2023 09:32 PM
Updated by: