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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Patching values (inclu...
Power Apps
Answered

Patching values (including an email field) from a collection

(0) ShareShare
ReportReport
Posted on by 67

Hi folks, looking for help with patching contents of a collection. Looked at the other similar posts but they didn't help me.

I have a collection, Test2, with two columns: Email (Email using DisplayName property) and Title (single line of text)

Mombo_0-1658271098887.png

 

I want to patch both columns from all records to a SharePoint list-TrainingTracker

TrainingTracker has 7 columns including Title (single line of text) and Email (Person or Group)

Mombo_1-1658271203168.png

Since the list and collection both have fields Title and Email I thought I could use this code: Collect(TrainingTracker,Test2)

But it didn't work. The collection has a field order of email, title whereas the list has Title, Email, Status, DueDate, BookedDate, CompletedDate and Completed

 

Then I tried the code below which didn't give any errors on creation, but failed in execution for "The specified user could not be found". (I manually added the email values in the picture above). The patch worked fine as long as I only try to patch the Title column. 

Mombo_2-1658271472312.png

 

Any help greatly appreciated.

Categories:
I have the same question (0)
  • EddieE Profile Picture
    4,641 Moderator on at

    @Mombo 

    Try wrapping Email in the Lower function, ie

    ForAll(
    ...
     { 
     Title: Title,
     Email:
     { ...
     Email: Lower(Email),
     ...
     }
     }
    ...
    )

    This can sometimes fix the issue?

     

    I'd also consider building the Email column in your collection as a Complex Type rather than a Text type. Then, you could simply use your original Collect function that you thought would work. Not sure if this is viable within your app though?

     

  • WarrenBelz Profile Picture
    153,073 Most Valuable Professional on at

    Hi @Mombo ,

    You had the @odata.type reference mis-spelt, you are better served patching to table rather than looping through the collection and you also had Ambiguity with identically named fields.

    Patch(
     TrainingTracker,
     ForAll(
     Test2 As aPatch,
     {
     Title: aPatch.Title,
     Email: 
     {
     '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
     Claims: "",
     Department: "",
     DisplayName: "",
     Email: aPatch.Email,
     JobTitle: "",
     Picture: ""
     }
     }
     )
    )

    I am also wondering why you are using a Person field the store just the email rather than a Text field.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Visit my blog Practical Power Apps

  • WarrenBelz Profile Picture
    153,073 Most Valuable Professional on at

    Hi @Mombo ,

    Just checking if you got the result you were looking for on this thread. Happy to help further if not.

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Visit my blog Practical Power Apps

  • Mombo Profile Picture
    67 on at

    Warren, thanks for the follow up. The problem of the patch not writing the email address to the destination list is not resolved. I don't think it is an issue with your code. Like before, the code works as long as I don't include the email in the patch statement (i.e. works fine with only Title). The content of collection Test2 is fine, but when I trigger the above code it returns the error:

    "The requested operation is invalid: Server response: Training Tracker failed: The specified user could not be found."

    Test2 contents is below and I am using my email address which is correct.

    Mombo_0-1658753818460.png

    Here is a summary of the intended process:

    1) On the screen, there is a drop down that the user selects to assign a role to an individual. It is dd_Role

    2) The on visible property of the screen creates two collections, test and test2

    Test looks into the course catalogue SharePoint list and brings back all course titles whose audience includes the selected dd_Role per:

    ClearCollect(
    Test,
    ShowColumns(
    Filter(
    'Course Catalog',
    dd_Role.Selected.Role in Audience.Value
    ),
    "Title"
    )
    );

    At this point, the content of Test is correct.

    3) Then Test2 is created which adds the current user's email to each record in Test per:

    ClearCollect(
    Test2,
    AddColumns(
    Test,
    "Email",
    User().Email
    )
    )

    The content of Test2 per picture above is correct.

    4) Then I try to patch each record of Test2 to the master training list per your code:

    Patch(
    TrainingTracker,
    ForAll(
    Test2 As aPatch,
    {
    Title: aPatch.Title,
    Email: {
    '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
    Claims: "",
    Department: "",
    DisplayName: "",
    Email: aPatch.Email,
    JobTitle: "",
    Picture: ""
    }
    }
    )
    )

     

    5. The code is fine as I am able to "format text" but it errors on execution per error above.

  • Mombo Profile Picture
    67 on at

    Eddie, thanks for the suggestion, but unfortunately it did not work for me.

  • Verified answer
    WiZey Profile Picture
    3,023 Moderator on at

    Hello @Mombo ,

     

    The error may occur because SharePoint is looking for an user whose claims is null.

     

    Can you try filling the "Claims" property with the value below and see how it goes?

     

    Claims:"i:0#.f|membership|" & aPatch.Email

     

  • Mombo Profile Picture
    67 on at

    Yes that was the issue.

     

    Thanks to the community for your collective assistance with this issue.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard