Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

How to add a constraint or prevent users from adding duplicated in a grid view

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello,

I have a grid view for contact correspondence inside a case entity. Users will have the option to add contacts and their roles such as complainant, respondent, lawyer etc. I want to limit the user's ability to add multiple complainants and respondent (but can have multiple lawyers).

Here is an image of the grid view 

contact_5F00_corr.png

As you can see I already have a respondent and Complainant in the grid and would like to remove that ability to add another. The Complainant Contact Role is an option set.

Thanks and any help is greatly appreciated.

*This post is locked for comments

  • Priyesh Profile Picture
    Priyesh 7,396 User Group Leader on at
    RE: How to add a constraint or prevent users from adding duplicated in a grid view

    Hi TJE,

    If our answers helped you out, kindly mark them as verified. Happy CRM'ing.

    Thanks!

  • Suggested answer
    gdas Profile Picture
    gdas 50,089 on at
    RE: How to add a constraint or prevent users from adding duplicated in a grid view

    Hi TJE,

    Plugin is the best approach in that case, it will work always server side.

    In addition you can also write JS validation when user choose complaints, respondent ,in the onchange of optionset using Web API retrieve the related contacts records with same role for the case , check if results is greater than 0 then set role optionset null and give  a notification to user. If there is no record added and result count is 0  then allow use to select the role . In case of lawyers you don't  don't need to validate.

    Hope this helps.

  • Suggested answer
    Priyesh Profile Picture
    Priyesh 7,396 User Group Leader on at
    RE: How to add a constraint or prevent users from adding duplicated in a grid view

    Hi,

    If you are familiar with custom C# plugin development for Dynamics 365, you can create a Pre-Operation plugin (it is always a synchronous plugin) that checks the record that is being created and throw an error message to the user saying that they can't add any more Contacts since there exists a duplicate.

    Hope this helps.

    Note: Please mark my answer as verified if this helped you. Thanks!

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 1 Super Users!

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

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,494 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,305 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans