IdentityNow Transforms - Conditional
Overview
The conditional transform allows you to output different values depending on simple conditional logic. This is a convenience transform in that the same capability could be implemented via a "static" transform, but with much greater simplicity and null-safe error checking.
Other Considerations
- The two operands within the transform cannot be null; if they are, an IllegalArgumentException will be thrown.
- If you are using an "accountAttribute" transform for either of the operands within your expression, it is recommended that you wrap that transform inside of a "firstValid" transform to ensure that null values do not get passed into the expression.
- The
expression
attribute must always be "eq" or the transform will throw an IllegalArgumentException. - All attribute string values are case-sensitive, so differently cased strings (e.g., "engineering" and "Engineering") will not return as matched
Transform Structure
In addition to the standard type
and name
attributes required by all transforms, the conditional transform requires an expression
, a positiveCondition
and a negativeCondition
. If the expression evaluates to false, the negative condition is returned, otherwise the positive condition is returned.
Example
{
"attributes": {
"expression": "foo eq foo",
"positiveCondition": "true",
"negativeCondition": "false"
},
"type": "conditional",
"name": "Test Conditional Transform"
}
Attributes
-
Required Attributes
- type - This must always be set to
conditional
- name - This is a required attribute for all transforms, and represents the name of the transform as it will appear in the UI's dropdowns
- expression - A comparison statement that follows the structure of
ValueA eq ValueB
whereValueA
andValueB
are static strings or outputs of other transforms; theeq
operator is the only valid comparison - positiveCondition - The output of the transform if the expression evaluates to true
- negativeCondition - The output of the transform if the expression evaluates to false
- type - This must always be set to
-
Optional Attributes
- requiresPeriodicRefresh - A
true
orfalse
value that indicates whether the transform logic should be re-evaluated every evening as part of the identity refresh process.
- requiresPeriodicRefresh - A
Examples
Example 1
{
"attributes": {
"expression": "$department eq Science",
"positiveCondition": "true",
"negativeCondition": "false",
"department": {
"attributes": {
"values": [
{
"attributes": {
"sourceName": "HR Source",
"attributeName": "department"
},
"type": "accountAttribute"
},
{
"attributes": {
"value": "none"
},
"type": "static"
}
]
},
"type": "firstValid"
}
},
"type": "conditional",
"name": "Test Conditional Transform"
}
This example takes the user's HR-defined department attribute and compares it to the value of "Science." If this is in fact the user's department, the transform will return "true," otherwise it will return "false."
Example 2
{
"attributes": {
"expression": "$department eq Science",
"positiveCondition": "$scienceBuilding",
"negativeCondition": "$adminBuilding",
"department": {
"attributes": {
"values": [
{
"attributes": {
"sourceName": "HR Source",
"attributeName": "department"
},
"type": "accountAttribute"
},
{
"attributes": {
"value": "none"
},
"type": "static"
}
]
},
"type": "firstValid"
},
"scienceBuilding": {
"attributes": {
"value": "Building S"
},
"type": "static"
},
"adminBuilding": {
"attributes": {
"value": "Building A"
},
"type": "static"
}
},
"type": "conditional",
"name": "Test Conditional Transform"
}
This example extends the previous one by returning the output of another Seaspray transform depending on the result of the expression. You can assign the outputs of Seaspray transforms to variables and then reference them within the positiveCondition
and negativeCondition
attributes.
References
- N/A
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Email to a Friend
- Report Content to Moderator
Hey,
I've tried to test this transform out however whenever I try to mimic the last example, I get the below error message. I was wondering if you had any ideas why it would be failing. When I try with string values instead of using another transform it works properly.
"There was an exception while calculating the value for this attribute. com.sailpoint.seaspray.template.TemplateException: Error rendering template: $UNSWGStaff"
Transform:
{
"attributes": {
"expression": "$name eq Bruce",
"positiveCondition": "$TNEStaff",
"negativeCondition": "$UNSWGStaff",
"name": {
"attributes": {
"attributeName": "firstName",
"sourceName": "Campus"
},
"type": "accountAttribute"
},
"TNEStaff": {
"attributes": {
"value": "TNE User"
},
"type": "static"
},
"UNSWGStaff": {
"attributes": {
"value": "UNSWGStaff"
},
"type": "static"
}
},
"type": "conditional",
"id": "Test Conditional Transform"
}
Regards
Brendon
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Email to a Friend
- Report Content to Moderator
Try to wrap(nest) this in firstValid transform it might work..
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Email to a Friend
- Report Content to Moderator
Unfortunately that gave me a Null Pointer Exception error. I've contacted Hari externally to this and is checking on it.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Email to a Friend
- Report Content to Moderator
Hi @brendonmurphy thanks for bringing this to our attention. It turns out there was a small bug in the order of evaluation logic on this transform; our engineering team will be sending out a fix to address this bug soon. I will try to update this thread as soon as I've confirmed that the fix is live.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Email to a Friend
- Report Content to Moderator
Hey Hari,
Thanks for the update. Glad to hear a resolution is on the way.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Email to a Friend
- Report Content to Moderator
@hari_patel I am getting the same error :
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Email to a Friend
- Report Content to Moderator
I am getting the same error :
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Email to a Friend
- Report Content to Moderator
@hari_patel I am also facing the same issue. Is there any resolution for this SailPoint bug?
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Email to a Friend
- Report Content to Moderator
I am getting the same error :
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Email to a Friend
- Report Content to Moderator
I am getting the same error :
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Email to a Friend
- Report Content to Moderator
@hari_patel , is this bug fixed? We are also seeing the same issue.
@hrathod007 @Karthikeyan1 @pblatt @Oumaima , did anyone of you fixed this issue? is there any alternate approach for that? please let us know. it is kind of urgent thing. Appreciate the help.
Best Regards
Venkat
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Email to a Friend
- Report Content to Moderator
same here, any update?
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Email to a Friend
- Report Content to Moderator
Thanks all for your continued engagement on this transform. The original transform "order of operations" evaluation bug which was reported in December of 2020 was addressed by Engineering in early 2021. After that point, the transform should have been evaluating correctly. One aspect which I know has tripped up some users is that both operands within the expression must be valid values -- they cannot be null.
The `com.sailpoint.seaspray.template.TemplateException: Error rendering template` message being thrown is directly related to that null value edge case. I've updated the "Other Considerations" language at top to highlight this requirement, provided guidance towards a firstValid "wrapper" transform, and also updated both examples to demonstrate the firstValid usage.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Email to a Friend
- Report Content to Moderator
I have the same error:
There was an exception while calculating the value for this attribute. com.sailpoint.seaspray.template.TemplateException: Error rendering template: $$PasswordRFC1
Transform: