I've got a Power App which allows users to answer "Yes/No" on a series of questions from a gallery and update a Sharepoint list by either adding a new record or updating the existing record. Adding a new record works fine, but the script won't update any existing record.
Key: 'Finance Skills Assessment - Responses' - The sharepoint list name (currently 30,000+ records) UserResponses = a collection based on the users responses to the sharepoint list (about 142 records maximum and set on app open and when the user enters the relevant page)
This is the part of my script which isn't working - any help would be greatly appreciated!:
ForAll(QuestionList.AllItems,
If(!IsBlankOrError(
LookUp(UserResponses,UniqueRef =
Concatenate(QuestionIDBox.Text,CurrentUserEmail)
)),
Patch('Finance Skills Assessment - Responses', LookUp('Finance Skills Assessment - Responses', UniqueRef = Concatenate(QuestionIDBox.Text,CurrentUserEmail)),
{
Response: If(YesNo.Value=true,"Yes","No"),
Timestamp: Now()
}),
Patch('Finance Skills Assessment - Responses', Defaults('Finance Skills Assessment - Responses'),
{ QuestionID : QuestionIDBox.Text ,
Response: If(YesNo.Value=true,"Yes","No"),
Timestamp: Now(),
UserPrinciple: CurrentUserEmail,
UniqueRef: Concatenate(QuestionIDBox.Text,CurrentUserEmail)
})
)
)