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 / Patch various types of...
Power Apps
Unanswered

Patch various types of records inside a dataverse column from the gallery

(0) ShareShare
ReportReport
Posted on by 65

Hi, I have a form like below where the user enters the person's name who are inside their organization and also have the ability to enter the names who are outside the organization. I'm using Dataverse as the backend.

Sumitra_Sai_1-1696501984166.png

Sumitra_Sai_2-1696502128848.png

  • For Internal, user has the ability to select names from the people picker ComboBox. When he clicks Add Internal button, the name will get stored inside the collection.

Sumitra_Sai_2-1696525624698.png

 

  • For External, user has the ability to give name and their corresponding email address. User clicks on Add External button, which will add those inside a collection.

Sumitra_Sai_1-1696525549265.png

 

And this is how, we are storing the internal and external users and displaying them inside a gallery.

 

Is it proper way to store both internal and external users inside a same collection?

Sumitra_Sai_0-1696501953199.png

1. How to add serial numbers or create unique ID on creation of a record inside the gallery?

2. Now, how to patch all of them inside the dataverse column on click of Submit button?

Sumitra_Sai_0-1696525508698.png

3. And also how to get corresponding Internal Mail ID for the respective user as we are fetching only Display names from the combobox? (Using Office365 Users) and need to patch along with them.

Sumitra_Sai_3-1696525711878.png

Or is there any other way to achieve this?

 

Kindly help me to resolve this issue.

Thanks in advance 🙂.

I have the same question (0)
  • Michael E. Gernaey Profile Picture
    53,452 Super User 2025 Season 2 on at

    Hi @Sumitra_Sai 

     

    Please see my answers below and INLINE

     


    @Sumitra_Sai wrote:

    Hi, I have a form like below where the user enters the person's name who are inside their organization and also have the ability to enter the names who are outside the organization. I'm using Dataverse as the backend.

    Sumitra_Sai_1-1696501984166.png

    Sumitra_Sai_2-1696502128848.png

    • For Internal, user has the ability to select names from the people picker ComboBox. When he clicks Add Internal button, the name will get stored inside the collection.

    Sumitra_Sai_2-1696525624698.png

     

    • For External, user has the ability to give name and their corresponding email address. User clicks on Add External button, which will add those inside a collection.

    Sumitra_Sai_1-1696525549265.png

     

    And this is how, we are storing the internal and external users and displaying them inside a gallery.

     

    Is it proper way to store both internal and external users inside a same collection?

    Sumitra_Sai_0-1696501953199.png

    [Michael] If I understand, your Collection looks great, but your back end is where the problem is. You should be using the same format as your Choice. Name, Email and a Choice Column (which is either Internal or External) values.

     

    So me personally you need to change your back end to reflect what you did in your collection for it to be correct.

     

     

    1. How to add serial numbers or create unique ID on creation of a record inside the gallery?

    [Michael] I do not understand what you mean by created inside the gallery? How are you creating them in the Gallery?

    I can understand that you maybe using a Collection that is bound to the Gallery. So are you asking, how do I generate a Unique ID that I can put in the Collection, which is being used BY the gallery?

     

    I want to point out, that once you store it in Dataverse, it will be given a unique GUID, but that you should NOT generate this yourself and pass it to Dataverse (under 99.999999999999999% of scenarios). 

     

    But if you just want a Unique ID for whatever reason, you can add a UniqueId column and use the GUID() function to generate a GUID for it. Just remember its NOT the guid from Dataverse, its just a temporary one.

     

    Most of the time, I don't suggest adding to a collection and then later on adding to Dataverse, many times for this reason, but I do understand sometimes it makes sense to do so.

     

     

    2. Now, how to patch all of them inside the dataverse column on click of Submit button?

    Sumitra_Sai_0-1696525508698.png

     

    [Michael] I have a sample Table called TestList. I have bound it to a Gallery. Now I am going to pretend like I want to add new records for each row in the gallery.

    What this does is loops through all the Gallery7.AllItems, and does a Patch on my Table, using the syntax Defaults(TestList), which mean new row, and then I supply the data for my columns

     

    But the other thing you see is that I have an If statement. That is because how you have your backend, I have to figure out do I populate the internal or the external columns.

     

    My if statement is completely wrong. I don't know if the gallery has a PersonType or how the heck you will know to populate the Internal versus External columns, but thats where you would.

     

     

    ForAll(Gallery7.AllItems,
     If(ThisRecord.PersonType = "Internal", 
     Patch(TestList, Defaults(TestList),
     {
     InternalPeopleName: ThisRecord.Name,
     InternalPeopleEmail: ThisRecord.Email,
     Id: IdLabel.Text // I made up this name
     }
     );
     ,
     Patch(TestList, Defaults(TestList),
     {
     ExternalPeopleName: ThisRecord.Name,
     ExternalPeopleEmail: ThisRecord.Email,
     Id: IdLabel.Text // I made up this name
     }
     );
     )
    );

     

     

     

     

    3. And also how to get corresponding Internal Mail ID for the respective user as we are fetching only Display names from the combobox? (Using Office365 Users) and need to patch along with them.

    Sumitra_Sai_3-1696525711878.png

    Or is there any other way to achieve this?

     

    [Michael]

    This is a little... bit of guess work on my part. But here is how I would do it.

    If your gallery gets the PersonType from your Collection, then the solution is pretty easy

    (and by mail id, you just mean the primary Email address right?)

     

    Step 1. Add a textlabel to your gallery. 

    Step 2. In the Text property, AND assuming your gallery is using your PersonType column from the colletion (again however you spell it im guessing). Then you would do this in the Text property

    Here it checks to see if my phoney PersonType = Internal

    If it does, I put two things here so you can pick which one you want (Id or Mail)

    If it does NOT equal Internal, then it just puts ""

    If the ThisItem.PersonType is blank it just puts ""

     

     

    If(!IsBlank(ThisItem.PersonType),
     If(ThisItem.PersonType = "Internal",
     // Here you will do the Office365User Query to get their Mail id.
     Office365Users.SearchUser({searchTerm:ThisRecord.InternalPersonName})).Mail 
     //or you can do
     Office365Users.SearchUser({searchTerm:ThisRecord.InternalPersonName})).Id
     ,
     ""
     ),
     ""
    )

     

     

     Please see ABOVE where I used this value to update the User Table. Again a guess.

     

     

    I would really appreciate if this helps if you can Mark it as an Answer/Resolved and maybe even a thumbs up.


    Cheers
    If you like my answer, please Mark it as Resolved, and give it a thumbs up, so it can help others
    Thank You
    Michael Gernaey MCT | MCSE | MCP | Self-Contractor| Ex-Microsoft
    https://gernaeysoftware.com
    LinkedIn: https://www.linkedin.com/in/michaelgernaey

  • Sumitra_Sai Profile Picture
    65 on at

    Hi @FLMike , thanks for your reply.

     

    1. But, what if I need to patch this Radio selected value along with the Gallery items? How to do that?

    Sumitra_Sai_1-1696581457113.png

     

    2. On updating the Internal User Mail from the Internal Username, I'm getting this error in the gallery.

    Sumitra_Sai_0-1696581423617.png

     

     

    Kindly help me to resolve this issue.

    Thanks in advance

     

  • Michael E. Gernaey Profile Picture
    53,452 Super User 2025 Season 2 on at

    hi @Sumitra_Sai 

     

    A couple things

    1. For this change the ThisRecord. to ThisItem, I wasn't sure exactly where you would access it, so I guessed.

    2. Is NomineeType a String? As I mentioned I wasn't sure on names and types.

    FLMike_0-1696599802142.png

     

    As for this, it depends, I don't see that in any of the Tables or Collections you have shared. So I wouldn't know where to save it.

    If its the Same Table, it also depends. Is it a Choice? or a Text field?

    Also, is it in the Collection and if so, please share the Column Type and the names of the Radio buttons

    FLMike_1-1696599955500.png

     

    Please show your appreciation by marking my Answers as Resolved and possibly even Thumbs Up

     


    Cheers
    If you like my answer, please Mark it as Resolved, and give it a thumbs up, so it can help others
    Thank You
    Michael Gernaey MCT | MCSE | MCP | Self-Contractor| Ex-Microsoft
    https://gernaeysoftware.com
    LinkedIn: https://www.linkedin.com/in/michaelgernaey

  • Sumitra_Sai Profile Picture
    65 on at

    Hi @FLMike , thanks for your reply.

     

    I have mentioned the Datatype of the columns in my Dataverse table.

    • InternalPeopleName - Single Line of Text
    • InternalPeopleEmail - Single Line of Text
    • ExternalPeopleName - Single Line of Text
    • ExternalPeopleEmail - Single Line of Text
    • TestRadioProperty - Single Line of Text
    • PeopleType - Single Line of Text

    Collection:

    • NomineeName
    • NomineeEmail
    • NomineeType

    Sumitra_Sai_0-1696833933414.png

    I'm getting error on this.

     

    Kindly help me to resolve this issue.

    Thanks in advance

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 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard