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 : P8mHixL545Vt3/nqndEj/b
Power Apps - Microsoft Dataverse
Answered

duplicate prevention based on multiple validations

Like (0) ShareShare
ReportReport
Posted on 13 Feb 2023 14:51:01 by 65

could anyone support me with the following requirement?

in model-driven app, I need to add a validation on a field (account) to make sure that it's not duplicated for the same selected value for other field (bank)

lets say we have bank A and bank B, I selected bank A and in account field I choose ACCOUNT-A, the app must get all the records on this table that has bank value A and check if any of these record has account value as ACCOUNT-A, if there's no match then same, else show error message

 

I've found JS code to make the first part duplicate account prevention descripted in this link,

but i cant add the other bank validation, could you please help me on this?

  • mohanade Profile Picture
    65 on 14 Feb 2023 at 01:59:35
    Re: duplicate prevention based on multiple validations

    thank you guys, it works

  • Verified answer
    EricRegnier Profile Picture
    8,714 Most Valuable Professional on 13 Feb 2023 at 19:34:10
    Re: duplicate prevention based on multiple validations

    If I understand the dedup rules trying to do I don't think it would work because it has to retrieve child records and validate against those. But it's true that out-of-the-box duplicate detection rules is a great feature!

  • Verified answer
    thomasfnorthrup Profile Picture
    252 on 13 Feb 2023 at 16:56:49
    Re: duplicate prevention based on multiple validations

    Hi, thanks for reaching out. You can certainly use custom code to accomplish this. The JS would give an error to the user as they change the field. However, I believe you can solve this with the OOTB duplicate detection rules. These trigger on save and will validate if a field is unique across all other records of that type. 

    To use these navigate to Advanced Settings > Data Management > Duplicate Detection Rules. There you can create a new rule and set it to validate off the field you want to be unique across all other records of the same type. 

    Good Luck! 

  • EricRegnier Profile Picture
    8,714 Most Valuable Professional on 13 Feb 2023 at 15:56:33
    Re: duplicate prevention based on multiple validations

    Hi @mohanade,

    Not sure I understand exactly the validation required, but it is possible to share your current code to help? You can have JS (frontend) or plugins (service-side) logic to validate. Depends if you would like this validation to be executed in other scenarios (eg integration or data import). Cheers

     

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 791 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 410 Super User 2025 Season 2

#3
mmbr1606 Profile Picture

mmbr1606 275 Super User 2025 Season 2

Featured topics

Loading complete