Hey folks,
I'm trying to create and update a record within a SharePoint list using the Patch function.
It seems that I can both create and update the record however when updating the record the other fields are wiped. I need to do it in this fashion as the Form contains to fields that perform a lookup in SharePoint. In my experience you cannot have 2 lookup fields on a single form as this creates a "server-side" error.
Here is my "code" :
Patch('HIEN Scheduling', Defaults('Scheduling'), { Email : DataCardValue158.Selected, MigrationWave : DataCardValue154.Selected, Session : DataCardValue157.Selected, Location : DataCardValue156.Selected, UserApplications : DataCardValue5.Text, AppsInSCCM : DataCardValue6.Selected, Notes : DataCardValue1.Text } ); Patch('Scheduling', {Email : DataCardValue158.Selected}, {Asset: DataCardValue168.Selected})
Both "Email" and "Asset" are lookup fields within SharePoint. Essentially this uses Patch in the first case to create the record. The second patch filters the list to show the single "Email" (There is validation on the list so it will only ever bring back a single value) then updates the "Asset".
I've found that this erases the previous fields and only populates the field mentioned in the second patch. "Asset".
Thanks.
J
Solved! Go to Solution.
If I am reading this correctly it is a syntax issue. Try
Patch('Scheduling', Email = DataCardValue158.Selected, {Asset: DataCardValue168.Selected})
I don't have an example in front of me to test but I know if you are checking to see if Email equals DataCardValue158.Selected you would not use a : the colon is for assignment, not evaluation.
If I am reading this correctly it is a syntax issue. Try
Patch('Scheduling', Email = DataCardValue158.Selected, {Asset: DataCardValue168.Selected})
I don't have an example in front of me to test but I know if you are checking to see if Email equals DataCardValue158.Selected you would not use a : the colon is for assignment, not evaluation.
Hi @Shanescows
You're right!
I also found a better way of doing it, strangely a form submission acts differently than a patch. Meaning I can submit to "lookup fields" at the same time without the issues with "SubmitForm".
Thanks,
J
Happy to see u here Shane. Your powerapps videos are great !!!
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
User | Count |
---|---|
189 | |
45 | |
45 | |
36 | |
35 |
User | Count |
---|---|
260 | |
82 | |
79 | |
69 | |
69 |