Announcements
No record found.
function CompletedRecordCount (executionContext) { var formContext = executionContext.getFormContext(); var completedRecordsFilter = "<filter type='and'><condition attribute='sksysdev_reviewstatus' operator='eq' value='2'/></filter>"; try { setTimeout(function () { if (formContext != null && formContext != undefined && formContext.getControl("Obligation_Review_Record_Subgrid") != null && formContext.getControl("Obligation_Review_Record_Subgrid") != undefined) { var totalcount = formContext.getControl("Obligation_Review_Record_Subgrid").getGrid().addCustomFilter(completedRecordsFilter, "sksysdev_obligationreview").getTotalRecordCount(); formContext.getAttribute("sksysdev_obligationreviewrecordcount").setValue(totalcount); } }, 3500); // You can increase some more time if its not works then } catch (e) { Xrm.Utility.alertDialog(functionName + "Error: " + e.message || e.description); } }
function CompletedObligationReviewCount (executionContext) { var formContext = executionContext.getFormContext(); // Get the subgrid control by its name var subgrid = formContext.getControl("Obligation_Review_Record_Subgrid"); // Check if the subgrid is loaded if (subgrid && subgrid.getGrid) { // Get the rows of the subgrid var rows = subgrid.getGrid().getRows(); var completedRecordsFilter = "<filter type='and'><condition attribute='sksysdev_reviewstatus' operator='eq' value='2'/></filter>"; formContext.getControl(subgrid).getGrid().addCustomFilter(completedRecordsFilter, entity); // Initialize a variable to store the total completed record counts var totalcount = 0; // Loop through each row for(var index=0; index<rows.getLength(); index++) // Get the data of the row var data = rows.get(index).getData(); // Get the entity of the row var entity = data.getEntity(); // Get the review status attribute of the entity var statuscounts = entity.attributes.get("sksysdev_reviewstatus"); // Check if the attribute has a value if (statuscounts && statuscounts.getValue()) { // Add the value to the total totalcount += statuscounts.getValue(); } }; // Display the total in the Obligation Review Record Count field (under Case) formContext.getAttribute("sksysdev_obligationreviewrecordcount").setValue(totalcount); }
function countCompletedReviews(executionContext) { var formContext = executionContext.getFormContext(); // Get the subgrid control by its name var subgrid = formContext.getControl("Subgrid_new_1"); // Check if the subgrid is loaded if (subgrid && subgrid.getGrid) { // Get the rows of the subgrid var rows = subgrid.getGrid().getRows(); // Initialize a variable to store the total count var total = 0; // Loop through each row for (var index = 0; index < rows.getLength(); index++) { // Get the data of the row var data = rows.get(index).getData(); // Get the entity of the row var entity = data.getEntity(); // Get the status attribute of the entity var status = entity.attributes.get("statuscode"); // Check if the attribute value is completed , 565930001 is value of completed status if (status && status.getValue() == 565930001) { // Add the number to the total total = total + 1; } } // populate filed formContext.getAttribute("cre80_completedreview").setValue(total); } }
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.
Congratulations to our 2026 Super Stars!
We are thrilled to have these Champions in our Community!
These are the community rock stars!
Stay up to date on forum activity by subscribing.
ManoVerse 196 Super User 2026 Season 1
11manish 129
CU11031447-0 100