Conditional transform working in sandbox but not production?

This works in my sandbox environment, but not in production.

There was an exception while calculating the value for this attribute. Error rendering template: $EmpStatus eq Leaveofabsence

"isLOA": {
    "type": "conditional",
    "attributes": {
        "EmpStatus": {
            "type": "replace",
            "attributes": {
                "input": {
                    "type": "identityAttribute",
                    "attributes": {
                        "name": "employmentStatus"
                    }
                },
                "regex": "\\s",
                "replacement": ""
            }
        },
        "expression": "$EmpStatus eq Leaveofabsence",
        "positiveCondition": "true",
        "negativeCondition": "false"
    }
},

Itā€™s probably because the $EmpStatus may be null. Trying the transform as below:

"isLOA": {
    "type": "conditional",
    "attributes": {
        "EmpStatus": {
            "type": "replace",
            "attributes": {
                "input": {
                    "type": "firstValid",
                    "attributes": {
                        "values": [
                        {
                            "type": "identityAttribute",
                            "attributes": {
                                "name": "employmentStatus"
                            }
                        },
                        {
                            "type": "static",
                            "attributes": {
                                "name": "NONE"
                            }
                        }
                        ]
                    }
                },
                "regex": "\\s",
                "replacement": ""
            }
        },
        "expression": "$EmpStatus eq Leaveofabsence",
        "positiveCondition": "true",
        "negativeCondition": "false"
    }
}

$EmpStatus is pulling the ā€œemployementStatusā€ identity attribute which has a value of ā€œLeave of absenceā€ in it. It then strips the spaces from it for the expression to compare.

Even if the identity attribute value were missing, the ā€˜NONEā€™ value would be returned and the expression would result in ā€œfalseā€ and not error.

Please pay attention to what I posted. I already said that the data and the code match from sandbox. It works there, but not in production. This is a bug in production in my opinion.

I believe there is an ā€œorder of operationsā€ issue in production and itā€™s not calculating the $EmpStatus value correctly.

Hello @pholdridge,

I get the same message ā€œError rendering template: $EmpStatus eq Leaveofabsenceā€ with your transform when the identityAttribute I use is not mapped.

For example, using the identityAttribute firstname would work but personalEmail would give the ā€œError rendering templateā€ message.

Can you verify that employmentStatus is mapped correctly in production?

Also as a note, it is not recommended to use identityAttributes during the calculation of another identityAttribute. We recommend using the accountAttribute transform when calculating other identity profile attributes.

This excerpt is pulled from the identityAttribute docs on our site.

  • This transform is not intended for use within an another identity profile attributeā€™s calculation. Identity attribute calculations are multi-threaded processes, and there is no guarantee that a specific attribute has current data, or even exists, at the time of calculation within any given transform. Referencing identity attributes within another identity attributeā€™s calculation can lead to identity exceptions.

I can confirm that employementStatus is populated with data. I see it on all identities and in preview.

We wanted to use Identity Attributes because it would require us to ā€œhard codeā€ a source name in the transform, which we prefer to avoid when possible.

Again, I want to emphasize for the third time that Sandbox works with the same data and same transform code. Please confirm if this works with your testing in Production before your next reply?

If we have no other choice, we will use an account attribute.

Thank you for confirming that.

I can confirm I am testing using a production environment.

I do see that the attribute is called employementStatus with an e after employ and in your transform code you are pulling the identityAttribute employmentStatus without the e.

Is the transform you posted the one you are using or is that just a mixup in copying here to the forum?

Hello @pholdridge,

I wanted to check-in with you. Did my last reply solve your issue? If not, Iā€™d love to help debug and see whatā€™s going on :slight_smile:

Instead of specifying the input you can just use the OOB field mapping interface available in the front-end. Then as your first value (in place if your ā€œidentityAttributeā€ transform) in your ā€œfirstValidā€ you could use:

{
"attributes": null,
"type": "trim"
}

This should get around specifying either an Identity Attribute or hardcoding a source name in our transform.

I appreciate it but I donā€™t know what you mean by this since Iā€™m still fairly new to IDN. Iā€™ve had to learn quickly in the last 2 months. Perhaps you can provide an full code with your proposal and explain it again?

1 Like

The problem as I understand it is that the first value in your nested ā€œfirstValidā€ transform references an Identity Attribute. And the alternative that you stated was to use an ā€œaccountAttributeā€ transform. But there is another option - to reference the value as it is configured in the front-end in the ā€œIdentity Profileā€ configuration screen. The easiest way that I have seen is to call a ā€œtrimā€ transform as a placeholder.

"isLOA": {
    "type": "conditional",
    "attributes": {
        "EmpStatus": {
            "type": "replace",
            "attributes": {
                "input": {
                    "type": "firstValid",
                    "attributes": {
                        "values": [
                        {
                            "type": "trim",
                            "attributes": null
                        },
                        {
                            "type": "static",
                            "attributes": {
                                "name": "NONE"
                            }
                        }
                        ]
                    }
                },
                "regex": "\\s",
                "replacement": ""
            }
        },
        "expression": "$EmpStatus eq Leaveofabsence",
        "positiveCondition": "true",
        "negativeCondition": "false"
    }
}
1 Like

When you say ā€œfront endā€ do you mean the mapping tab in IDN Identity Profile?

Source: XXX / Attribute: Employment Status / Transform:

Thanks for the help by the wayā€¦

1 Like

This seems to work. Thank you so much man!

1 Like

Huzzah! Iā€™m so glad we were able to get you an answer, Peter! Donā€™t forget to checkout all of our docs on transforms, and please come back if you have any questions.

If you ever have feedback, for example something thatā€™s missing from our docs, like us know over in the #community:feedback category!