I have a Aggregate with Users ID, and with that list I want to put in a ForEach, to call a REST /get/userid
thats give me a Response of Users Information.
It is possible to use a ForEach to get all the Responses at once, and save in a Variable/Output like a UserInfo List type, so I can use as a Source in the Screen Table?
I don't know what would be the best practice to solve that, I'm trying something like the image below:
Hi,
Here is the sample of appending usersinfo to list
Reegards,
Wasimkhan S
Hi bruno Jacby,Use list Append function in forEach to append the data one by one.
Hi Bruno,
REST methods are called synchronously, so if you call a REST method in a For Each, the next iteration won't commence until the REST method has finished.
As others have commented, you can add each response to a List by using a ListAppend in each iteration. Note however that depending on the number of items in the list, this can take quite some time, as REST methods are typically much slower than server actions.
Ideally, if you have control over the REST API you are calling, the REST method should have a list of Ids as input, and a list of results as output. In that case you only need to call the API once, which will be much faster.
Hi @Bruno Jacby,I also agree with @Kilian Hekhuis comment.Calling API multiple times and that is also in for loop is not good practice.Check with API Input output structure if it is supporting multiple Input output structure Then create array of userID and send it to that API so the number of API calls get reduce.Also for better performance create batch of 15 to 25 userId at a time according to API performance and add exception handling as well as handle the timeout operations .Thanks,Madhuri
Thank you all @Madhuri Patil, @Kilian Hekhuis, @Wasim Khan, @Venkatesaiya
solved