Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 general forum

Run a workflow on all related records of an entity to allow only one record to be classified as "primary".

Posted on by Microsoft Employee

I have an Entity named "Loan". I have another entity named "Borrower". A loan can have many borrowers. And a borrower can have many loans. I have created an intersect entity to create the N:N relationship. On the intersect entity I have a field named "Type", the option can be "Primary" or "Co-borrower". A new Borrower/Loan is added to the "loan" record with a quick create form which is accessed by clicking "+ Add New Borrower" on a subgrid on the loan form. The  Borrower/Loan relationship entity has a lookup field to "Borrower". 


I want to stop the user from creating more than one "Primary" Borrower/Loan relationship. Is there a way to build a workflow that displays an error message to the user if they make more than one Borrower/Loan relationship "Primary"? 

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Run a workflow on all related records of an entity to allow only one record to be classified as "primary".

    I ended up using Alternate Keys. I created a new field called "Is Primary" on the intersect entity. I created a workflow that updated this field to "Yes" when the "Type" Field was set to "Primary". My two alternate keys consisted of Loan+Is Primary, and Loan+Borrower. This way the user gets a duplicate detection error if two "primary" borrowers are added or the same borrower is associated with the loan twice.

  • Suggested answer
    Mahendar Pal Profile Picture
    Mahendar Pal 45,095 on at
    RE: Run a workflow on all related records of an entity to allow only one record to be classified as "primary".

    Hi,

    One possible option could be to see if some custom workflow activity tool will help you to query based on your requirements and once you got result show error ,check this github.com/.../Query%20Values%20Step.md another option could be to develop your own custom workflow to query data to validate if there is already association exists, further you can show error message accordingly

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 Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans