web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Unanswered

Live App not handling formulas the same way as the build preview

(0) ShareShare
ReportReport
Posted on by 20
Hi all, 
 
I am having an issue with the differences between the live app and the app preview. I have a datatable that is going to be the source for my records. I want users to be able to add and delete from this table, but I also want to have the ability for "management" to lock out specific rows to prevent accidental deletion. I am currently doing this via a ISLocked Yes/no column in the table, that I hope to figure out how to lock out to specific users in case they do access the table itself. 
 
I am using the following formula to do this, 
 
If(
    !IsBlank(
        LookUp(
            'PN-PD-PM Tables',
            cr3c2_pnpdpmtableid = PartNumberGallery.Selected.cr3c2_pnpdpmtableid && IsLocked = true
        )
    ),
    Notify("This item is locked and cannot be deleted.", NotificationType.Error),
    IfError(
        Remove(
            'PN-PD-PM Tables',
            LookUp(
                'PN-PD-PM Tables',
                cr3c2_pnpdpmtableid = PartNumberGallery.Selected.cr3c2_pnpdpmtableid && IsLocked = false
            )
        ),
        Notify("You are not allowed to delete items.", NotificationType.Error)
    );
    // Only runs if Remove succeeds
    Notify("Item deleted successfully.", NotificationType.Success);
    Set(varToDelete_Parts, Blank());
    Back()
)
 
But it appears that it only seems to work on the app preview. Once I navigate to the live app, it prevents the record from being deleted and sends the user back to the gallery. The problem is it is currently displaying the "Item deleted successfully" error (which it shouldn't because the item is locked) but not displaying the item is locked and cannot be deleted. 
 
I have been using AI to help me build this, but it appears stuck on this loop. I can correct the notifications, but then I loose the ISLocked function and it deletes the record regardless. 
 
Perhaps there is a different way to accomplish this...? 
 
 
I have the same question (0)
  • WarrenBelz Profile Picture
    151,881 Most Valuable Professional on at
    Live App not handling formulas the same way as the build preview
    Maybe the sequence of the lotgic - try this
    With(
       {
          _Record:
          LookUp(
             'PN-PD-PM Tables',
             cr3c2_pnpdpmtableid = PartNumberGallery.Selected.cr3c2_pnpdpmtableid
          )
       },
       If(
          !IsBlank(_Record),
          Notify(
             "Record not found",
             NotificationType.Error
          ),
          _Record.IsLocked,
          Notify(
             "This item is locked and cannot be deleted.", 
             NotificationType.Error
          ),
          IsError(
             Remove(
                'PN-PD-PM Tables',
                _Record
             ),
             Notify(
                "You are not allowed to delete items.", 
                NotificationType.Error
             ),
             Notify(
                "Item deleted successfully.", 
                NotificationType.Success
             );
             Set(
                varToDelete_Parts, 
                Blank()
             );
             Back()
          )
       )
    )
     
    Please ✅ Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider answering Yes to Was this reply helpful? or give it a Like ♥
    Visit my blog
    Practical Power Apps    LinkedIn  

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 766 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 419 Super User 2025 Season 2

#3
developerAJ Profile Picture

developerAJ 235

Last 30 days Overall leaderboard