Xrm.Utility.openWebResourceDialog method is not available in the current release and will be added in next release.
How to get XRM context from custom button JavaScript? (online 2013)
-
12-10-2022 - |
Question
I want to call Xrm.Utility.openWebResourceDialog(...)
from custom JavaScript that runs when a custom button is pressed.
In order for this to work, I have to have ClientGlobalContext.js.aspx
loaded. I tried adding the following action to my button's command definition:
<JavaScriptFunction FunctionName="isNaN" Library="$webresource:ClientGlobalContext.js.aspx" />
but when I go to import the solution, I get the following error
The ribbon item my_command_id is dependent on Web resource id='ClientGlobalContext.js.aspx'
Is there any way to access XRM functionality from custom button JavaScript?
Solution
OTHER TIPS
In "Library" you must specify your own js web resource where function with "FunctionName" defined, like:
<JavaScriptFunction FunctionName="myFun" Library="$webresource:myJsWebResource.js"/>
In that function you can use Xrm.Utility.openWebResourceDialog(...), because XRM.Utility functions available in every application page that supports scripting.