how to loop a!completeTask function and save the result

how to loop a!completeTask function and save the result

 

i have list of task ids and list of  task inputs,on click of a button it should be able to complete tasks using a!completeTask function in a loop,but am unable to do it in a loop.Can anyone help on this? 

 a!buttonWidget(
label: "complete task",
saveInto: {
/* how to write the below function in loop and how to save it using a!save function*/
a!completeTask(
taskId: tointeger(ri!selectedTaskIDs ),
taskInputs: { input: ri!taskInput },
onSuccess: a!save(ri!message, "Updated Successfully"),
onError: a!save(ri!message, "Already Updated")
)
},
style: "PRIMARY"
)

 

 

Thanks in advance

 Discussion posts and replies are publicly visible