cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Iamglt
Helper V
Helper V

Label not updating after a form updates and some patch commands for combo boxes are run via Save button

Hi Folks

I have a status bar that displays a label in the status bar in the bottom of my form (Edit-Form - Not Saved):

Iamglt_0-1611227472179.png

The first part of the status is set depending on if the form is in Edit or New Mode.  The second Part is the status is displays if the form has been saved or is unsaved.  

I tried to add a third component to this, so that if any of the fields are updated on the form, the OnChange for all fields property on each filed sets the the variable (varSaveStatus) to "Data Changed - Not Saved', using the following code:

 

et(
    varSaveStatus,
    "Data Changed - Not Saved"
)

 

Iamglt_1-1611228081701.png

After I push the save button, the status should update to:

Iamglt_2-1611228156805.png

But after I update a combo box, it updates to the 'Edit Form - Saved' for a second, the reverts back to this:

Iamglt_1-1611228081701.png

If I hit the save button a second time, then it works as it should, displaying:

Iamglt_2-1611228156805.png

The above works fine for basic text fields. but when any of the Combo boxes are changed, the save button needs to be pressed twice.  The code on the save button is as follows:

 

If(
    varMode = "Edit",
    Patch(
        NewEmployeeOnboarding,
        {ID: galSumDashboard.Selected.ID},
        {BusinessUnit: ComboBox2.Selected.Result},
        {Division: ComboBox3.Selected.DropDownDivisionList},
        {EmploymentType: ComboBox1.Selected.Value},
        {OnBoardingApproval: ComboBox4.Selected.DisplayName},
        frmEmpDetails.Updates;
    ),
    Patch(
        NewEmployeeOnboarding,
        Defaults(NewEmployeeOnboarding),
        {BusinessUnit: ComboBox2.Selected.Result},
        {Division: ComboBox3.Selected.DropDownDivisionList},
        {EmploymentType: ComboBox1.Selected.Value},
        {OnBoardingApproval: ComboBox4.Selected.DisplayName},
        frmEmpDetails.Updates;
    )
);
Set(
    varSaveStatus,
    "Saved"
);

 

Is there a timing issue (i.e. the Save process to a SharePoint list) runs in parallel with the Set command in the above Save button code?  I have tried taking the Set statements away from the Combo boxes, and it seems to work fine so it looks like the combo boxes are the issue.  Does anyone know what would cause this behavior?

 

Cheers,

Geoff

0 REPLIES 0

Helpful resources

Announcements
User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (3,230)