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
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (1,730)