Dynamic search for custom object property
If I convert JSON to a custom object, I can access the custom object's properties only if I explicitly call them. e.g. When I iterate through the elements of custom object, I need to specify %CurrentItem.propertyname%. However, if the property names are set in a list and I try to use %CurrentItem.list%, WA throws an error, "List is not a valid field". It will be nice to have this feature of accessing the custom object's property values dynamically, with WA just throwing this error if a illegal name was indeed passed.
Please note that in case the property of a Custom Object is of type "list", then you should be able to access the list items like you mention.
For example, please try to convert the following JSON text to a custom object, using the "Convert Json to Custom Object" Action.
You will notice that the Names can be accessed by their indexes.
Thanks Peter for responding. That part does work, but I was referring to dynamic variable name at run time. In your example, it will work if I say %CurrentItem.Name%. However, let's say I want to access the values of Surname and Department and I have a list [List] with these two keys.So
List = Surname
List = Department
Now if I try to access it with %CurrentItem.List%, it will not work. It will only work if I specify %CurrentItem.Surname%. We have a requirement where the key-value pair in the JSON are constantly changing. So we wanted to specify the "keys" we want to access in a comma separated txt file so that we can read these at run time into a list and then access it using %CurrentItem.List%.