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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Field constraint for Status on entity

(0) ShareShare
ReportReport
Posted on by 1,570

I am trying to determine how to add a constraint on a Project Status field on an entity.

The case is I have a parent entity (Project) with 1 to many relation to sub entity (Project Tasks), but I only want to allow 1 Project Task Status set to "Active".

I know I can set a single drop list on the parent that says "Active Task" and just select the active one.

But I prefer to have status set on each task item with only 1 allowed to be Active. If I try to change another to active I would display error "Only 1 active task allowed.".   Hopefully that make sense.

Any advice ?  Thank you.

*This post is locked for comments

I have the same question (0)
  • TomSmelser Profile Picture
    1,570 on at

    I think I figured this out.  If you create a duplicate detection rule on the Status and the Parent record it will flag as a duplicate.  Not sure this is the cleanest solution but it works.  If anyone has other solutions please post.


    Thank you.

  • Suggested answer
    Community Member Profile Picture
    on at

    Hi TomSmelser,

    You can write a plugin which will fire on create and update of Project Task Entity to achieve same .

    1. In plugin you will get Parent record ID(Project).

    2. Retrieve all Project Task for that Project with Project task status as Active via FetchXML.

    3. Check if count of retrieved record is Zero the its OK Else Throw error "Only 1 active task allowed."

    Hope this Helps !! I would appreciate if you can mark my answer as verified if it was helpful. Thanks

    Regards,

    Kamran

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
ScottDurow Profile Picture

ScottDurow 2

#2
GJones Profile Picture

GJones 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans