Skip to main content

Notifications

Power Apps - Building Power Apps
Unanswered

Odd behavior in Toggle control

Posted on 26 Nov 2024 22:26:29 by 124
I have a toggle control that I am using to set an Is Active flag for a record in the database. I have a Power Automate Flow that calls a stored procedure that updates the value in my SQL Server DB. I have set the Default value of the Toggle to be the bit value in the database via a Lookup
 
LookUp('VC.BusinessEntities',BusinessEntityId=galBusinessEntity.Selected.BusinessEntityId).IsActive
This is all working well so far.
 
I have the OnChange property of the toggle set to run my flow:
 
UpdateContext(
    {
        OnChangeResult: VC_BusinessEntityIsActive.Run(
            galBusinessEntity.Selected.BusinessEntityId,
            tglIsActive_CarrierEdit_1.Value,
            User().FullName
        )
    }
);
 If(
        OnChangeResult.statuscode = "200",
        Notify(
            "Save Successful",
            NotificationType.Success,
            5000
        ),
        Notify(
            OnChangeResult.errormessage,
            NotificationType.Error,
            5000
        )
    );
Again, so far so good. The odd behavior is that the first time I access my edit screen where this control lives it fires the flow even though I haven't selected or changed the value of the control. Is this the intended behavior? How do I configure the control so that this doesn't happen?
Categories:
  • ronaldwalcott Profile Picture
    ronaldwalcott 764 on 26 Nov 2024 at 23:18:15
    Odd behavior in Toggle control
    Does the toggle have a default value?
    Also, you could consider using the new toggle control which has an OnCheck and OnUncheck property.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,129

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 63,797

Leaderboard