Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Mandatory a Subgrid for at least one record

(0) ShareShare
ReportReport
Posted on by 958

Hi All,

What is the best approach to make a Subgrid required for at least one record and check this condition before a case record is resolved?

As per my understanding, I think I need to make a plugin for the same.

Please suggest.

*This post is locked for comments

  • Suggested answer
    Vipin J Profile Picture
    1,603 on at
    RE: Mandatory a Subgrid for at least one record

    Plugin would be perfect solution for given problem here to restrict case getting closed before any record in child entity.

    My Blog : https://vjcity.blogspot.com/2019/08/guidelines-to-write-good-javascript.html

  • Suggested answer
    Nijos Profile Picture
    1,672 on at
    RE: Mandatory a Subgrid for at least one record

    Hi,

    You can use either plugin or JS but if there is business process where cases are closed from back end or in bulk JS wont serve the purpose as its client side. so plugin will be a better option.

    Nijo,

    Please mark as verified if this was helpful.

  • Suggested answer
    Pawar Pravin  Profile Picture
    5,237 on at
    RE: Mandatory a Subgrid for at least one record

    Please try on pre operation (status update) to check subgrid record count.

  • Shakti Singh Rajput Profile Picture
    958 on at
    RE: Mandatory a Subgrid for at least one record

    Yes Kabarousse, You are right but for check this condition on before resolve the case record would be completed by Plugin only.

  • Suggested answer
    Saad Kabarousse Profile Picture
    734 on at
    RE: Mandatory a Subgrid for at least one record

    Hi,

    I think a Plugin would not be necessary, a javascprit function that  get teh count of your subgrid maybe enough, you can check if the count is > 0 and what ever you want.

    I hope this works for you :)

  • Suggested answer
    Community Member Profile Picture
    on at
    RE: Mandatory a Subgrid for at least one record

    A way to count grid childs in js way is as bellow:

    function getTotalGridRecordCount() {

    try {

    setTimeout(function () {

    if (Xrm.Page != null && Xrm.Page != undefined && Xrm.Page.getControl("gridname") != null && Xrm.Page.getControl("gridname") != undefined) {

    var count = Xrm.Page.getControl("gridname").getGrid().getTotalRecordCount();

    alert("Total Childs:"+count);

    }

    }, 5000);

    }

    catch (e) {

    Xrm.Utility.alertDialog(functionName + "Error: " + e.message || e.description);

    }

    }

    But as the best approach i would suggest a Plugin.

    Thank you,

    Arjol

  • Shakti Singh Rajput Profile Picture
    958 on at
    RE: Mandatory a Subgrid for at least one record

    Thanks Goutam.

  • Suggested answer
    gdas Profile Picture
    50,091 Moderator on at
    RE: Mandatory a Subgrid for at least one record

    Your  understanding is correct , using OOB workflow you can not validate child records . Plugin is the best options to validate subgrid records in your scenario.

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics CRM (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 83 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 52

#3
Victor Onyebuchi Profile Picture

Victor Onyebuchi 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans