Hi All,
Having trouble with my forms not updating. Here is the scenario:
On a previous screen, a record is selected via a Combobox (LComboBox1) and the user clicks "View Details."
ViewDetails OnSelect: Set(FormActionVar, FormMode.View); Navigate(FView).
FView contains a form (FViewForm) which shows contract data. Relevant properties of FViewForm:
DataSource: BidContract (List on SP)
Item: LComboBox1.Selected
Form mode: FormActionVar
User can now click an Edit button ( set(FormActionVar,FormMode.Edit) - I did this rather than EditForm because I also use the variable to show/hide the save and discard changes button)
User can make changes to the form, then click Save. The desired behavior is for it to submit the changes, notify the user of a success, change the form back to View, and show the updated values. Here is my Save's button OnSelect:
SubmitForm(FViewForm);
If(
IsEmpty(Errors(BidContract)),
Notify("Changes saved successfully.", NotificationType.Success
);
Set(FormActionVar, FormMode.View); ResetForm(FViewForm),
Notify(
First(Errors(BidContract)).Message,
NotificationType.Error
)
)
However, that does not work. I even tried it with a Patch function:
Set(varPatch,LComboBox1.Selected);
Patch(BidContract, varPatch, FViewForm.Updates)
If(
IsEmpty(Errors(BidContract)),
Notify(
"Successfully Saved!", NotificationType.Success
); Set(FormActionVar,FormMode.View);ResetForm(FViewForm),
Notify(
First(Errors(BidContract)).Message,
NotificationType.Error
)
)
I have tried to include a Refresh of BidContract, but I am not sure where to insert it.
Has anyone found a good solution for this issue?
Solved! Go to Solution.
Don't put anything other than SubmitForm() in the button. The rest should be in the OnSuccess property of the form itself.
You don't want to execute those commands until the data is successfully submitted.
As @Drrickryp has mentioned, most of your formula should be in the OnSuccess and OnFailure of the form. Your submit action should simply be SubmitForm(FViewForm)
In your OnSuccess you should have:
Notify("Changes saved successfully.", NotificationType.Success);
ViewForm(FViewForm)
In your OnFailure you should have nothing really as the form will have already shown the errors that were encountered.
Hi @saleksanyan ,
Can you please elaborate more on what is the error. Is the data not pushing into SharePoint list or you are unable to see notifications either success or failure?
Don't put anything other than SubmitForm() in the button. The rest should be in the OnSuccess property of the form itself.
You don't want to execute those commands until the data is successfully submitted.
Thanks - forgot to clear this up.
The data is actually correctly going into the sharepoint list. Once the form goes back into View, the values revert to the old ones.
Hi @saleksanyan ,
Can you remove ResetForm(FViewForm).
Once the submit form is done, you are setting back the form mode to view. That should be fine.
As @Drrickryp has mentioned, most of your formula should be in the OnSuccess and OnFailure of the form. Your submit action should simply be SubmitForm(FViewForm)
In your OnSuccess you should have:
Notify("Changes saved successfully.", NotificationType.Success);
ViewForm(FViewForm)
In your OnFailure you should have nothing really as the form will have already shown the errors that were encountered.
Got it - made that change. Now, another question:
Some of the form's values drive a gallery. When I update those values, the gallery does not update, even if OnSuccess has Reset(Gallery). Anything that can be done there?
Reset(Gallery) will do nothing - remove it.
What is the Items property of your Gallery?
Gallery's Datasource is a different file called VendData. The Form has keys for vendors (V1, V2,... V10) that indicate which vendors are associated with a contract. The VxID is the data card of the actual form, which updates correctly - but the gallery does not refresh until I go out and back in. I also tried to have the OnVisible perform a Refresh(VendData), but that didn't do anything.
Gallery's Items is expressed as follows:
Filter(
VendData,
IVID = V1DC.Text Or IVID = V2DC.Text Or IVID = V3DC.Text Or IVID = V4DC.Text Or IVID = V5DC.Text Or IVID = V6DC.Text Or IVID = V7DC.Text Or IVID = V8DC.Text Or IVID = V9DC.Text Or IVID = VADC.Text
)
It's a bit hard to visualize.
So, some questions for clarity:
1) Your Gallery is based on VendData with is a list DataSource in SharePoint?
2) Your Form is based on the BidContract list which is used in the Items property of the LComboBox1 - what is that Items formula?
3) What are these? V1DC, V2DC....VADC And where are they? You mention they are in your form?
I'm trying to establish the connection of your Gallery items to what you are submitting.
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.
User | Count |
---|---|
206 | |
98 | |
58 | |
51 | |
42 |
User | Count |
---|---|
260 | |
158 | |
84 | |
79 | |
57 |