Get Multivalued data from account attribute transform for contains check

Hi All,

I have a requirement where i need to check a multi valued source attribute for a value “ABC”. If “ABC” is part of the multi valued attribute then i need to set a static value based on that logic. I am using below logic but this is successful only in the case when the value “ABC” is the first value in the multi valued attribute.

{
    "type": "static",
    "attributes": {
        "GetAttribute": {
            "attributes": {
                "attributeName": "attributeName",
                "sourceName": "SourceName"
            },
            "type": "accountAttribute"
        },
        "SetABC": {
            "attributes": {
                "value": "Has ABC"
            },
            "type": "static"
        },
        "SetDefault": {
            "attributes": {
                "value": "NA"
            },
            "type": "static"
        },
        "value": "#if($GetAttribute.toString().contains('ABC'))$SetABC#{else}$SetDefault#end"
    }
}

The above code gives output “Has ABC” if “ABC” is the first value in the multi valued attribute but it returns “NA” if “ABC” is at any other position than 1st in the attribute.

Kindly share your views/ideas if anyone has achieve this. Thanks in advance.

This Transform will fulfil your requirement.

{
    "name": "MultiValued Static Transform",
    "type": "static",
    "attributes": {
        "HasABC": {
            "attributes": {
                "values": [
                    {
                        "type": "accountAttribute",
                        "attributes": {
                            "attributeName": "anyAccountAttribute",
                            "sourceName": "sourceName",
                            "accountPropertyFilter": "(attributeName.contains(\"ABC\"))"
                        }
                    },
                    {
                        "attributes": {
                            "value": "none"
                        },
                        "type": "static"
                    }
                ]
            },
            "type": "firstValid"
        },
        "value": "#if ($HasABC != 'none') Yes #else No #end"
    },
    "internal": false
}

Thanks for the help. This works.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.