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 940

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
    Vipin J 1,583 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
    Nijos 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
    Pawar Pravin 5,231 on at
    RE: Mandatory a Subgrid for at least one record

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

  • 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
    Saad Kabarousse 732 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
    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

  • RE: Mandatory a Subgrid for at least one record

    Thanks Goutam.

  • Suggested answer
    gdas Profile Picture
    gdas 50,089 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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

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

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 231,432 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans