Ritu Rai

Ritu Rai

  • NA
  • 5
  • 1k

Sel. Multiple records in a gallery and Patch with the PowerApps ForAll

Aug 30 2023 11:46 AM

I have one query related to Power apps. I am stuck in this process. please suggest to me what will be the code for this process.
I am creating an Appraisal application.
I want to create or update records in a SharePoint list named ‘Appraisal Test’ based on user interactions in a Power Apps gallery. Each record contains information like Label1, Label2, and a radio button choice. Records should be associated with the logged-in user’s email (UserName1 column). On click of a button.

OnSelect button on the Screen where Gallery is present

ForAll(
RenameColumns(
Gallery1.AllItems,
“ID”,
“ID1″
),
Patch(
‘Appraisal Test’,
LookUp(‘Appraisal Test’, ID = ID1),
{
Label1: ThisRecord.Label1,
Label2: ThisRecord.Label2,
RadioButton: { Value: Radio4.Selected.Value },
UserName1: varloggedInUser.Email
}
)
)
On Start of App
Set(varLoggedInUser, User());

With(
{wUserRecord: LookUp(Employees, EmailID = varLoggedInUser.Email)},
Set(varUser, wUserRecord.EmpName);
Set(varRole, wUserRecord.UserRoles.Value)
);

The first time I interacted, the ‘UserName1’ column and the radio button were successfully created with the user’s name and chosen value, respectively. However, when I logged in using a different user account, a new row was not created for that user. Instead, the app updated radio button values for the exiting user.”
I will be very grateful if you give me the formula for the above scenario.

Thanks in advance.


Answers (1)