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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Prevent deletion of re...
Power Apps
Answered

Prevent deletion of records where it is used for a lookup?

(0) ShareShare
ReportReport
Posted on by 88

Hi all,

 

Is there a way in Dataverse to stop a record being deleted when it is used as a lookup in a child table?

 

As an example:

Table A contains the row "Business Unit 1"

Table B looks up to table A and creates a record referencing business unit 1

 

How can I prevent the deletion of the row "Business Unit 1" so that it does not break the hierarchy?

 

Thanks!

I have the same question (0)
  • Verified answer
    MarioRing Profile Picture
    541 Super User 2024 Season 1 on at

    Yes, it is possible by using the configuration.

    Go to make.powerapps.com, go to solutions, and choose your solution. Then find your "protected" table on the list, navigate to the "Relationships" and select the relationship with the second object (if there is no relationship there, please use the "add existing" feature). Click "Advanced options" and set the value "Restrict" in the "Delete" field. Save all and publish.

     

    MarioRing_0-1689003447020.png

    In this example I used the relationship between Contact and Account (as Primary Contact). If the Contact is used as Primary Contact for any Account (there is a lookup for single Contact on the Account form) it is not possible to delete this Contact:

    MarioRing_1-1689003880792.png

     

    Read more about this in the documentation here.

  • THowkins96 Profile Picture
    88 on at

    Hi @MarioRing 

     

    Thank you so much for that! That's perfect 🙂

     

    Can I just clarify one thing, if a row is deleted by a dataflow rather than manually as a result of enabling the "delete rows no longer in the query output" feature, will this still prevent the deletion of the row if there are dependencies elsewhere in the data?

     

    Thanks

    Tom

  • MarioRing Profile Picture
    541 Super User 2024 Season 1 on at

    Good question. Unfortunately, I've never tried this way. You can verify it on your own and share the outcome with us! In my opinion that situation should throw an error.

  • THowkins96 Profile Picture
    88 on at

    I've just carried out a test to see what would happen and as it turns out it does indeed not delete the row that no longer existst in the output! Success!

     

    It does not however tell you in your dataflow that it was unsuccessful, you get the green tick as per usual dataflow success!

     

    Really nice feature, thanks again for your help @MarioRing 

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 765 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard