Notifications
Announcements
No record found.
i try to hide the + button from Subgrid invoice detail in the entity invoice when statuscode is equal to 181510000 but it not worked any help!!
i do following:
1)create Javascript:
function hideSub(executionContext) { var formContext = executionContext.getFormContext(); if(formContext.getAttribute("statecode").getValue() == 181510000) return true; else return false; }
2) i add Enable rule
3) i add the rule to the command
Hey bud,
Ribbon buttons don't get formContext the same way as on the form itself. You get the formContext from the primaryControl you pass as a parameter not the executionContext. See this great article on how to get the formContext from ribbon buttons. https://www.magnetismsolutions.com/blog/alfwynjordan/2019/10/02/getting-dynamics-365-formcontext-from-ribbon-workbench
Try:
function hideSub(primaryControl) { var formContext = primaryControl.getFormContext(); if(formContext.getAttribute("statecode").getValue() == 181510000) return true; else return false; }
Also try setting inverse result as false.
Hi,
Use below code to fix your issue.
function hideSub(primaryControl) { var formContext = primaryControl; if(formContext.getAttribute("statecode").getValue() == 181510000) return true; else return false; }
You will have to pass primarycontrol from ribbon. see below image.
OOB statecode value which you have mentioned in your code which is 181510000. you added new options?
Why I ask this because OOB statecode optionset doesnot have this value
.
hi,
the statecode value yes i added, i have tested with your code but it still not working do you have another idea.
thank u
Strange!
It seems to be working on my trial account.
I myself validate this and posted blog as well.
xrmdynamicscrm.wordpress.com/.../
can you please share your code and screenshot of configuration you did on ribbon workbench.
If found helpful, Please mark my answer verified.
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.
Tom_Gioielli 83 Super User 2025 Season 2
Gerardo RenterÃa Ga... 49 Most Valuable Professional
#ManoVerse 40