web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Adding users to forall...
Power Apps
Answered

Adding users to forall record creation

(0) ShareShare
ReportReport
Posted on by 31

Hi All,

 

This references a previous question that I asked: Solved: Allowing a user to create multiple records with sa... - Power Platform Community (microsoft.com). In that, I asked how I could have a user create multiple new records based on a set of input criteria. I successfully utilized the guidance in that to build out the process, but then ran into a new problem. The sequenced list has the list of users that need to be patched into the People column of the SharePoint list. However, every time I try, I end up only referencing the first user in the list for all 241 records. My most recent version of the code is here:

Collect(
 'Attestation-tblAttestation',
 ForAll(
 Sequence(
 CountRows(collectSequencedList),
 1,
 1
 )As MySSCCreation, 
 {
 ChangeManagementSession: dtpkCMSession.SelectedDate,
 Status: {Value: "No Response"},
 UserAttestationDate: Today(),
 SSC_Submitter:
 {
 '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser", 
 Department:"",
 //Claims:"i:0#.f|membership|" & collectSequencedList.Email,
 //DisplayName: collectSequencedList.DisplayName, 
 //Email: collectSequencedList.Email, 
 JobTitle:"", 
 Picture:"" 
 }
 }
 )
)

I tried using Last(FirstN(collectSequencedList)).Email, but that also only generated the first user in the list as well.

 

collectSequencedList has the following three columns:

RowNumber, Name, Email. Rownumber starts at 1 and goes to the end of the list as well.

 

Any help in making sure that all 241 users or whatever are included in the SequencedList are inserted into SharePoint would be greatly appreciated.

 

Thanks!

Categories:
  • APowerAppNewb Profile Picture
    31 on at

    Well, this is embarrassing. I was able to get the loop working properly using the following code: 

    ForAll(
     Sequence(CountRows(collectSequencedList)) As File,
     Collect(
     'Attestation-tblAttestation',
     ForAll(
     Sequence(
     CountRows(collectSequencedList),
     1,
     1
     )As MySSCCreation,
     {
     ChangeManagementSession: dtpkCMSession.SelectedDate,
     Status: {Value: "No Response"},
     UserAttestationDate: Today(),
     SSC_Submitter: {
     '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
     Department: "",
     Claims: "i:0#.f|membership|" & LookUp(
     collectSequencedList,
     RowNumber = File.Value
     ).Email,
     DisplayName: LookUp(
     collectSequencedList,
     RowNumber = File.Value
     ).DisplayName,
     Email: LookUp(
     collectSequencedList,
     RowNumber = File.Value
     ).Email,
     JobTitle: "",
     Picture: ""
     }
     }
     )
     )
    )

     

    However, when I ran it, it ended up creating almost 800 records. The collection itself only has 241 records. How can I ensure that only the number of records in the collection are created, and not duplicates?

  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @APowerAppNewb 

    It need not be so complex!

     

    Please consider changing your Formula to the following:

    Collect(
     'Attestation-tblAttestation',
     ForAll(collectSequencedList
     {
     ChangeManagementSession: dtpkCMSession.SelectedDate,
     Status: {Value: "No Response"},
     UserAttestationDate: Today(),
     SSC_Submitter:
     {
     Department:"",
     Claims:"i:0#.f|membership|" & Lower(Email),
     DisplayName: DisplayName, 
     Email: Email, 
     JobTitle:"", 
     Picture:"" 
     }
     }
     )
    )

     This will create a record for each record in your collectionSequencedList in the datasource.

     

    I hope this is helpful for you.

  • APowerAppNewb Profile Picture
    31 on at

    You are an absolute lifesaver, Randy! I really have no idea why I couldn't figure that out sooner, but thank you so much for the answer!

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @APowerAppNewb 

    No problem!  Always Keep It Super Simple!!! 😁

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 236 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 188 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 130

Last 30 days Overall leaderboard