PROBLEM: Cannot change value of field. I select a new value from a dropdown field on a form, hit save. Field value reverts to previous value. Cannot change the value of this field for any records.
The Deets
Power Apps canvas app with
- a GALLERY populated by a SharePoint list called 'Team Directory'
- 'Team Directory' has a text field called 'Office', which is populated by a dropdown field called 'Office (Office0)' on the 'editDetails' form in Power Apps.
- an EDIT FORM (named 'editDetails') populated by selecting a gallery item (person).
The Items property for the dropdown field 'Office (Office0)' is 'officeCollection'.
- 'officeCollection' pulls the 'Title' field values from a SharePoint list called 'Offices', and adds two additional choices: All Offices and (Add New).
- This collection occurs via Screen 1's OnVisible property, which is:
ClearCollect(officeCollection, {Title: "All Offices"}); Collect(officeCollection, {Title: "(Add New)"}); Collect(officeCollection, Sort(ShowColumns(Offices, "Title"), Title, Ascending));
Other properties of the 'Office (Office0)' dropdown field:
- OnChange: If(Self.Selected.Title = "(Add New)", UpdateContext({addNewHeader: "Add New Office"}) & NewForm('frmAddNew-Office') & UpdateContext({frmOfficeViz: true, grayScreenViz: true})) -- (This opens a small form by which users can add a new option to the list of choices for this field.)
- SelectMultiple: false
- DefaultSelectedItems: ThisItem.'Office (Office0)'
- Reset: false
- IsSearchable: false
Properties of the 'Office' data card on the 'editDetails' form:
- DataField: 'Office0'
- DisplayName: 'Office'
- Default: ThisItem.'Office (Office0)'
- Update:
The OnSelect property of the Save button on the 'editDetails' form:
If(editDetails.Mode = FormMode.New And CountRows(Filter('Team Directory', upn = upnEditDetails.Text)) > 0, UpdateContext({ProfileExistsMsgViz: true, grayScreenViz: true}), UpdateContext({varTimerStart: false}); SubmitForm(editDetails); UpdateContext({savedPopupViz: true, varTimerStart: true}); Refresh('Team Directory'); Set(varAMA, ""); Reset('NewProfile-nameSelector'); UpdateContext({editDetailsViz:false, newFormViz: false, viewDetailsViz:true}))
- If(editDetails.Mode = FormMode.New And CountRows(Filter('Team Directory', upn = upnEditDetails.Text)) > 0, UpdateContext({ProfileExistsMsgViz: true, grayScreenViz: true}) -- checks to make sure a profile does not already exist for this person and shows a warning message if one does.
- SubmitForm(editDetails); -- submits the form, obvs.
- UpdateContext({savedPopupViz: true, varTimerStart: true}); -- starts the timer for the "Save Successful" pop-up message.
- Refresh('Team Directory'); -- refreshes data source
- Set(varAMA, ""); -- clears an unrelated variable
- Reset('NewProfile-nameSelector'); -- resets an unrelated dropdown
- UpdateContext({editDetailsViz:false, newFormViz: false, viewDetailsViz:true})) -- hides the 'editDetails' form and, if a new record, also hides features specific to creating a new record. Displays the 'viewDetails' form.
Any idea where I'm going wrong? Would throwing my laptop out a high window fix it?