cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

How to use except formula in the nested object ?

amalim
Deputy Chef I
Deputy Chef I

I have an array which look like this below. I can manage to remove the 1st level of fields using except formula.
users[0].except(:two_factor_auth_enabled,:signature).
I am trying to remove the nested object field using the below formula.
users[0].except(:two_factor_auth_enabled,:signature,:user_fields["city"]).
But it is not working as expected. Kindly give me the solution for this process.

"users": [
        {
            "id": 12345,
            "name": "Abdul Khader Malim",
            "email": "amalim@logitech.com",
            "two_factor_auth_enabled": null,
            "signature": "",
            "user_fields": {
                "address_line_1": "3221 COLEMAN AVE",
                "address_line_2": null,
                "birth_year": null,
                "city": "OCEANSIDE",
                "company_school": null,
                "country": "country_nl",
                "gender": null,
                "newsletter_subscription": false,
                "postal_code": "92054",
                "region": null,
                "school_district": null,
                "site": null,
                "state": "CA"
            }
        }
    ]

 

2 REPLIES 2

gary1
Executive Chef III
Executive Chef III

I can't find a way to target the nested array either. You might have to break it out separately and combine them. I'm interested to know if you find a more elegant solution.

ndy
Deputy Chef I
Deputy Chef I

Dear, @amalim 

In Workato, the except formula does not directly work on nested object like you have in the user_fields. When you're trying to remove fields from a nested object, you can't use the except formula directly on fields within that nested structure.

To handle this is to reconstruct a new variable.
Screenshot 2024-10-15 100024.png

Nguyen Duc Y