Announcements
No record found.
Hi All,
I have created a web form with 5 steps where 4th and 5th steps have only subrid with create button to create new record. I have a business logic to check whether any record in the subgrid. If the subgid doesn't have any value, then it should display error message and shouldn't allow to move next step. When a count is more than 1, it should allow to move next step.
Could you please help me with code how this can be done.
Thank you,
Leo
Hi partner,
I suggest that you could try the following way.
1.Get your subgrid record count in web form with JS code first.
Please refer to this thread about how to get record count.
https://community.dynamics.com/crm/f/microsoft-dynamics-crm-forum/292653/how-to-get-subgrid-row-count-in-entity-form-partner-portal?pifragment-97030=1
2.Set the record count to a custom field on the web form or entity form.
3.Add a condition step and set the condition to if custom field >0.
Best Regards,
Hi Leo,
Thank you very much for this work around. When I added the script given in the blog and did debug the code, I just saw that it didn't go inside the function and it came out of from execution after return statement if (typeof (Page_Validators) == 'undefined') return; ).
if (window.jQuery) { (function ($) { $(document).ready(function () { debugger; if (typeof (Page_Validators) == 'undefined') return; // came our from exectuion after this line var newValidator = document.createElement('span'); newValidator.style.display = "none"; newValidator.id = "ValidateLeadRecords"; newValidator.errormessage = "At leaset one record is required for leads"; newValidator.evaluationfunction = function () { var rowCount = 0; rowCount = $("#Project_PartnerPortal").length; if (rowCount <=0) { alert("Yes it works for count 0"); return false; } else { alert("Yes it works for count 1"); return true; } }; Page_Validators.push(newValidator); }); }(window.jQuery)); } Also, I tried this code but the same was happened, if (window.jQuery) { (function ($) { if (typeof (webFormClientValidate) != 'undefined') { var originalValidationFunction = webFormClientValidate; if (originalValidationFunction && typeof (originalValidationFunction) == "function") { webFormClientValidate = function () { originalValidationFunction.apply(this, arguments); // do your custom validation here // return false; // to prevent the form submit you need to return false // end custom validation. $("#new_fulladdress").prop('disabled', false); $("#new_fulladdress_mailing").prop('disabled', false); return true; }; } } }(window.jQuery)); }
Could you please help help me here!
Regards,
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 community stars!
Expanding mentorship, skilling, and AI innovation
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Syed Aqib Raza 42
11manish 33 Super User 2026 Season 2
Travis South 33