Greetings,
The purpose of the post is to explain, seek advise and robust solutions to the below Anomaly experienced when populating a List Variable in SAP Intelligent Robotic Process Automation.
Use case:
We are currently automating a propose by reading data from a 3rd party solution using a REST API.
Figure 1: Process Automation
- We have a Custom script embedded with the API logic
- Call web service element for the service call
- Write to Json file element: which holds the returned results from the webservice
- Read json file element: to read a specific field being the username within the json file
- For Each element: within the for each loop we read a specific field being the username into a list variable and an add item(List) element.
- Custom script: Which declares an empty list then populates the list with usernames from the previously collected data which resides in the Read json file element step 4
Figure 2:Custom Script Logic
- Add item(List): Which adds the collected names in above custom script to the element.
The Above process successfully executes and iterates through the file as expected, However:
- The List variable, Overwrites the entries populated at each iteration instead of appending
- Furthermore, the List variable holds the last name then populates null values.
Results from various iterations, we have also attached the list results to the post:
Kind Regards,