Hi New to ribbon workbench, I want to Hide custom entity add new "+" button on a sub-grid based on lead status reason custom value = "100,000,002"
Can someone please guide how to achieve this?
Should I just use ribbon workbench? or do I need to load any web resource javascript file?
Thank you in advance.
I'm glad I was able to help!
Hey Andrew.
A big thank you, my friend. It's working fine now. I used your code and added the CRM parameter. Works perfectly fine. I tested a bunch of orders with different status and works well. Thank you so much.
I also subscribed to your youtube channel to learn more from you.
You can use any. Both codes do the same thing but I prefer second one.
Sure, below is the command screenshot.
And if I am using primary control which code should I use the one below 1 or 2 ?
1. function hideSub(primaryControl)
{
var formContext = primaryControl;
return (formContext.getAttribute(“statuscode”).getValue() === 100000002);
}
2. function hideSub(formContext)
{
return (formContext.getAttribute("statuscode").getValue() === 100000002);
}
According you your last screenshot (with the rule) you don't pass the context into the function. Check this article please - blog.magnetismsolutions.com/.../getting-dynamics-365-formcontext-from-ribbon-workbench
Also just as an additional check can you please provide screenshot of Mscrm.AddNewRecordFromSubgridStandard command?
Hi Andrew. Yes, I have updated it to statuscode. Below are all the screen shots.
1. Web resource
2. Lead Statuscode
3. RWB Command settings - All the display rules and enable rules IsCore is set to True as described in the link.
Custom entity(sfiorder) subgrid added to Lead form is still showing Add New on the Lead page will all the status.
As we discussed earlier it should be statuscode, not statecode so try the code
function hideSub(formContext) {
return (formContext.getAttribute("statuscode").getValue() === 100000002);
}
Also don't forget to place the field on the form.
Andrew, I fixed the code error by re-adding CRM parameters for Add New Command.
However, I am still not able to achieve the requirement.
So far, I added the JS Web Resource with the below code and followed the link you provided. But still not working.
ribbonworkbench.uservoice.com/.../489288-show-or-hide-the-add-new-button-on-form-sub-grid
function hideSub(formContext)
{
return (formContext.getAttribute("statecode").getValue() === 100000002);
}
I have no idea what could cause this.
Now getting below error in CRM when clicking on Add New Record
TypeError: Cannot read property 'getRelationship' of undefined
at OpenLibrary.addNewFromSubGridStandard (test.crm.dynamics.com/.../Main_system_library.js:1:281229)
at sl.executeFunction (test.crm.dynamics.com/.../app.js
at sl.execute (test.crm.dynamics.com/.../app.js
at test.crm.dynamics.com/.../4.js
at i (test.crm.dynamics.com/.../app.js
at test.crm.dynamics.com/.../4.js
at Array.forEach (<anonymous>)
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156