web
You’re offline. This is a read only version of the page.
close
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

I have the same question (0)
  • Suggested answer
    gdas Profile Picture
    50,091 Moderator on at

    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.

  • Shakti Singh Rajput Profile Picture
    958 on at

    Thanks Goutam.

  • Suggested answer
    Community Member Profile Picture
    on at

    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

  • Suggested answer
    Saad Kabarousse Profile Picture
    734 on at

    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 :)

  • Shakti Singh Rajput Profile Picture
    958 on at

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

  • Suggested answer
    Pawar Pravin  Profile Picture
    5,237 on at

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

  • Suggested answer
    Nijos Profile Picture
    1,672 on at

    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
    Vipin J Profile Picture
    1,603 on at

    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

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans