Hello All Experts,
May i know whether it is possible to fetch a record using ajax call within developers tool by using javascript.
*This post is locked for comments
Hello All Experts,
May i know whether it is possible to fetch a record using ajax call within developers tool by using javascript.
*This post is locked for comments
Hello All Experts,
Finally i have tried with below code and it's working for me.
This will help us to write code in debugger console without disturbing the MSCRM.
var serverUrl = Xrm.Page.context.getClientUrl();
var oDataEndpointUrl = serverUrl + "/XRMServices/2011/OrganizationData.svc/";
var Roles = Xrm.Page.context.getUserRoles();
var RoleId = Roles[i];
var selectQuery = "/RoleSet?$top=1&$filter=RoleId eq guid'" + RoleId + "'&$select=Name";
oDataEndpointUrl += selectQuery;
var service = new XMLHttpRequest();
if (service != null) {
service.open("GET", oDataEndpointUrl, false);
service.setRequestHeader("X-Requested-With", "XMLHttpRequest");
service.setRequestHeader("Accept", "application/json, text/javascript, */*");
service.send(null);
var retrieved = JSON.parse(service.responseText).d;
var results = new Array();
for (var i = 0; i < retrieved.results.length; i++) {
results.push(retrieved.results[i]);
}
console.log(results);
}
I believe it will help to others as well.
Hello Gopalan,
Yes the same thing i want.
i don't want to put any javascript webresource inside the crm .
rather i directly want to write code inside debugger console.
but as you said there needs to be ajax context so how can i bring that ajax context there?
If you want to test a new function which is not available in the current context (Example: the JS Web resource file).
When debugging (breaking at a break point) the code, open the Console window.
Now paste the new function and execute.
After that you can invoke the function by entering the function name in the console.
This is what you are asking?
Please use Console tab in F12 to write your code while debugging
Hello Gopalan,
can you elaborate a little more.
You should be able to do this
As long as you have Ajax library (Example: JQuery) in the context.
Paste the functions first.
Then invoke the functions.
Hi,
not sure why you would need it. You can run a script in the debugger console, but you would need to add that whole script there (and I never tried to add more than a single function call.. it's a single line input, after all)
You might add a web resource, create a function that you want to call, and, then, call that function from the console instead..
Hello Guys,
if i simply write
Xrm.Page.data.entity.getId(); in debugger console it will give me guid of the record.
likewise i want to write the whole ajax code within the console and not putting them in the crm as a webresource and want to get the result as i get guid .
is it possible or not?
hope you guys understand the question.
Best way to check while debugging isto put the code line in a Watch.
Hello Guys,
i don't want to add any webresource.
simply i want to write the code within debugger console .
i hope you guys understand what i am trying to find out.
André Arnaud de Cal...
292,516
Super User 2025 Season 1
Martin Dráb
231,407
Most Valuable Professional
nmaenpaa
101,156