Lookup transform

I have a requirement to compare two account attributes (workerstatus__c and workerstatus1__c) and set lifecycle state based on workerstatus1__c meaning if workerstatus1 is on leave and workerstatus is active, set lifecycle state to leave, any idea?

“name”: “lifecycle state”,
“type”: “static”,
“attributes”: {
“value”: “#{if}($futurehire == “Hire”)futurehire#{else}$Status#{end}”,
“Status”: {
“type”: “lookup”,
“attributes”: {
“input”: {
“type”: “firstValid”,
“attributes”: {
“values”: [
{
“type”: “accountAttribute”,
“attributes”: {
“sourceName”: “HR”,
“attributeName”: “WorkerStatus__c”
}
},
“NONE”
]
}
},
“table”: {
“Active”: “active”,
“On leave”: “leave”,
“Terminated”: “terminated”,
“default”: “”
}
}
},
“futurehire”: {
“type”: “firstValid”,
“attributes”: {
“values”: [
{
“type”: “accountAttribute”,
“attributes”: {
“sourceName”: “HR”,
“attributeName”: “Future_Hire”
}
},
“NONE”
]
}
}
},
“internal”: false
}

You need to use nested transform with static and account attribute transforms. You can try the below transform to achieve it and build more logic on top of it using more elseif.

{
        "name": "lifecycle state",
        "type": "static",
        "attributes": {
            "status": {
                "attributes": {
                    "values": [
                        {
                            "attributes": {
                                "attributeName": "workerstatus__c",
                                "sourceName": "HR"
                            },
                            "type": "accountAttribute"
                        },
                        "none"
                    ]
                },
                "type": "firstValid"
            },
            "status1": {
                "attributes": {
                    "values": [
                        {
                            "attributes": {
                                "attributeName": "workerstatus1__c",
                                "sourceName": "HR"
                            },
                            "type": "accountAttribute"
                        },
                        "none"
                    ]
                },
                "type": "firstValid"
            },
            "value": "#if ($status == 'active' && $status1 == 'onleave')leave#{else}other#end"
        },
        "internal": false
    }
1 Like

Hello @ssel

Use the example of below Static Transform. I have created a static transform using your example which you provided in your question. Using Velocity code within Static transform will serve the purpose best.

{
    "name": "Static Transform LCS State",
    "type": "static",
    "attributes": {
        "workerstatus": {
            "attributes": {
                "values": [
                    {
                        "type": "accountAttribute",
                        "attributes": {
                            "sourceName": "WorkDay",
                            "attributeName": "workerstatus__c"
                        }
                    },
                    {
                        "attributes": {
                            "value": "NA"
                        },
                        "type": "static"
                    }
                ]
            },
            "type": "firstValid",
            "ignoreErrors": "true"
        },
        "workerstatus1": {
            "attributes": {
                "values": [
                    {
                        "type": "accountAttribute",
                        "attributes": {
                            "sourceName": "WorkDay",
                            "attributeName": "workerstatus1__c"
                        }
                    },
                    {
                        "attributes": {
                            "value": "NA"
                        },
                        "type": "static"
                    }
                ]
            },
            "type": "firstValid",
            "ignoreErrors": "true"
        },
        "value": "#if($workerstatus != 'NA' && $workerstatus1 != 'NA' && $workerstatus1 != 'on leave' && $workerstatus != 'active')leave#end"
    }
}
1 Like

Thank you, that helps!