cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
BraneyBI
Level: Powered On

PowerApps: Return TaskID when creating Planner tasks in bulk using ForAll

In PowerApps, I need to create sets of tasks associated with a single Plan and Bucket.  The code I use is this:

 

ForAll(SelectedMeetingTasks,Planner.CreateTask(SelectedMeeting.PlanGUID, title,{bucketIdSmiley FrustratedelectedMeeting.BucketGUID,dueDateTime:AssnTaskDueDate,assignments:AssignToUser.Id}))


It properly creates the tasks, but I am unsure how to return the Task IDs after the tasks are created.  Not sure if I need to wrap this in another command. 
The only examples I have seen return the ID are processed one by one and not using the ForAll.
I need to update other systems with the newly created IDs. 

1 ACCEPTED SOLUTION

Accepted Solutions
strategery
Level 8

Re: PowerApps: Return TaskID when creating Planner tasks in bulk using ForAll

 

CreateTask should return the created task as a record, so wrap it in Collect. Put it inside the ForAll and it should grab each task created as a new record in the collection. Put Clear in front of it if you need a fresh list each time this ForAll runs

 

Clear(createdTasks);ForAll(SelectedMeetingTasks, Collect(createdTasks,Planner.CreateTask( ... ) ) )

2 REPLIES 2
strategery
Level 8

Re: PowerApps: Return TaskID when creating Planner tasks in bulk using ForAll

 

CreateTask should return the created task as a record, so wrap it in Collect. Put it inside the ForAll and it should grab each task created as a new record in the collection. Put Clear in front of it if you need a fresh list each time this ForAll runs

 

Clear(createdTasks);ForAll(SelectedMeetingTasks, Collect(createdTasks,Planner.CreateTask( ... ) ) )

BraneyBI
Level: Powered On

Re: PowerApps: Return TaskID when creating Planner tasks in bulk using ForAll

Fantastic!  Worked like a charm!  
The way you explained it makes SO much sense.  Thank you for adding to my further understanding of the PowerApps coding language.