Notifications
Announcements
No record found.
Hi
i have contact sub grid on Account entity . i want when account status is inactive then sub grid should be read only.
*This post is locked for comments
Hi Arun,
This happens by default i.e. when you deactivate the account record, the add new button gets removed from the subgrid and you can no longer add the contacts from their.
Are you looking for something else?
yeah.. new button is removed when record is inactive but i want user should not able to read record from sub grid.
Hi,
then you should hide the subgrid with a Javascript function running onLoad. It will check the status and then show/hide your subgrid if it is active/inactive
Here are some sample functions:
www.powerobjects.com/.../friday-flash-tip-hide-show-sub-grids-crm-2016-pick-selected-rows-using-javascript
here are another post: community.dynamics.com/.../192667
Thanks Domont
but i want to show grid as read only.
Hi Ak,
proceed as follows:
1) Add statuscode attribute to your form
2) Move your subgrid to a new section, we name "MYSECTION"
2) Add a javascript library with the following code to you form
function FormOnLoad() { var statecode = Xrm.Page.getAttribute("statecode").getValue(); if (statecode == 1) // not active { Xrm.Page.ui.tabs.get('TABWHICHCONTAINSMYSECTION').sections.get('MYSECTION').setVisible(false); } }
2) On load events, call FormOnLoad function
3) You are done!
Please let me know if you solve.
If you found the answer helpful, please mark as Verified
Join my network on LinkedIn Follow me on Twitter
Thank You & Best Regards
Francesco Picchi
Microsoft Dynamics CRM Consultant, Bologna+Milano, ITALY
Independent Contractor
http://www.francescopicchi.com
Pls follow the below forum thread with the verified suggestion and modify your subgrid accordingly.
community.dynamics.com/.../197142
Hope this helps. If suggestion resolved your query Mark it as verified to close the thread
Please insert below code on account form's "onLoad" event.
here, subGridName=Contacts, which the name of your desired subgrid.
function subgrid(subGridName)
{
debugger;
if(Xrm.Page.getAttribute("statecode").getValue() == 1)
Xrm.Page.getControl(subGridName).setVisible(false);
}
just copy and paste above code and pass "Contacts" as parameter
Thanks,
Hardik Chauhan
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
SA-08121319-0 4
Calum MacFarlane 4
Alex Fun Wei Jie 2