Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 79901

Regarding Subgrid count

$
0
0

Hello Sir,

I have a product subgrid on lead form and I have written a javascript code to count number of products present in subgrid .

My code :

function SelectProductFamily_OnLoad(executionContext) {
// debugger;
var formContext = executionContext.getFormContext();
var formType = formContext.ui.getFormType();
setTimeout(function () {
debugger;
if (formContext.getControl("productsubgrid") != undefined && formContext.getControl("productsubgrid") != "") {
var leadCount = formContext.getControl("productsubgrid").getGrid().getTotalRecordCount();
// alert(leadCount);
var x = parseInt(leadCount);
if (formType == 2 && x == 0) {
formContext.ui.setFormNotification("Please Add Product Family.", "ERROR", "1");
}
else {
formContext.ui.clearFormNotification("1");
}

};
}, 2000);
}

it works but when after save and agin load the lead it shows message : "Please Add Product Family."


Viewing all articles
Browse latest Browse all 79901

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>