var formContext = executionContext.getFormContext(); formContext.getControl("WebResouce_CopyAccountID").setVisible(true);
*This post is locked for comments
Yes, finally debugged the Javascript and got this working.
The code which worked is:
formContext._ui._controls._collectionItem.WebResource_CopyAccountID.setVisible(true);
Hope it helps someone.
Hi
Did you get this working?
Sorry for the typo, I need to show the web resource which is by default visible false.
Hi
To hide web resource you have to set the setvisibility --> false
formContext.getControl("WebResouce_CopyAccountID").setVisible(false);
I would do a publish all, Open in different browser session, incognito if possible and see if script can pick up, this way you can rule out its definitely not caching issue.
When this script is executing, could it be its executing before the web resource control is rendered?
If you still have the issue, could you share screenshot of the web resource properties on the form.
Thanks
Hi Pravin,
XRM.Page is deprecated and no longer works for Unified interface.
Hi Kokulan,
The context is not null but the control is null even though the ID is correct.
The error says 'Unable to get property 'setVisible' of undefined or null reference'
Hi Priyank,
Did you tried using Xrm library ?
Xrm.Page.getControl("WebResouce_CopyAccountID").setVisible(true);
Also check visibility in JS after setVisible function
Hi
Your code seems to be correct and it should work, please try the following
01. Make sure the Web Resource name is correct - Copy and paste the name from the webresource properties.
02. Add a "debugger;" line just above the formContext and open dev tool and step through the lines, make sure formContext is not null
03. Also check formContext.getControl("WebResouce_CopyAccountID") is not null
Above all, make sure you do Ctrl+F5 to flush the cache
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