$oldValue returns old value of 'identityAtribute' on which transforms are applied and not desired 'accountAttribute'

In below transform I’m trying to change JOBCODE to 1 if DEPT value is changed. But, on debugging what I observed that $oldValue returns old value JOBCODE itself(as transform is applied on it) instead of old value of DEPT. What I should do to get old DEPT value so that I can compare it?

{
        "id": "JobCode Change Status",
        "type": "static",
        "attributes": {
            "requiresPeriodicRefresh" : "true",
            "deptChange": {
                "attributes": {
                    "expression": "$department eq $olddepartment",
                    "positiveCondition": "true",
                    "negativeCondition": "false",
                    "department": {
                        "attributes": {
                            "sourceName": "Delimited File",
                            "attributeName": "DEPT"
                        },
                        "type": "accountAttribute"
                    },
                    "olddepartment": {
                        "attributes": {
                            "input": {
                                "attributes": {
                                    "ignoreErrors": "true",
                                    "values": [
                                        "$oldValue",
                                        {
                                            "attributes": {
                                                "sourceName": "Delimited File",
                                                "attributeName": "DEPT"
                                            },
                                            "type": "accountAttribute"
                                        },
                                        "none"
                                    ]
                                },
                                "type": "firstValid"
                            }
                        },
                        "type": "lower"
                    }
                },
                "type": "conditional"
            },
            "value": "#if($deptChange.equalsIgnoreCase('false'))1#end"
        }
    }

Hi Swapnil,

oldValue will change as the data gets refreshed if you apply transform on it. You can try with an IdentityAttribute rule. Have two Identity attribute, one to hold the old value & other one to have the calculated data using rule.

Regards,
Anamica

1 Like

Thank you so much Anamica, I’ll give a try for IdentityAttribute Rule