Expand my Community achievements bar.

SOLVED

Query not working in webApp

Avatar

Level 7

Hello everyone, I've been trying to query the service table via Javascript, but i don't get any records.

Heku__0-1697194755726.png

I've tried lots of querys and giving admin access to the webApp user, but nothing appears in the debugging page

Heku__1-1697194910587.png

Any solution? Thank you in advance

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hello @Heku_ ,

i have never used select all tbh. You can print result with JSON.Stringify(). Can you skip that selectAll?. Have you tried something like:

var res = query.ExecuteQuery();
var services= res.getElementsByTagName("service");

logInfo(services.length);
logInfo(JSON.Stringify(services));

 Do you have admin rights? Have you run the web app in admin mode? You can escalate admin rights for the query when you do not want to give admin rights to web app user.

 

Marcel Szimonisz

View solution in original post

8 Replies

Avatar

Community Advisor

Hi @Heku_ 

 

In the <select> tag you aren't defining any <node> to select for the querydef. You can try giving nodes inside the select to get the results. Nodes are the parameters you want to query/get using the querydef function.

Example:- 

AkshayAnand_1-1697196000699.png

Hope this helps.

 

Regards

Akshay

Avatar

Level 7

No, SelectAll adds all fields on the select part, so node isn't needed. I've tried it anyway but it didn't work...

Avatar

Community Advisor

Hi @Heku_ 

 

Also your logs will not be visible in the debug mode, you can see your logs under Home>>Monitoring >> web@default >> Open log journal . There you can sort based on the dates and you will be able to see your lgs for webapps.

AkshayAnand_0-1697197557547.png

 

 

Regards

Akshay

Avatar

Community Advisor

Hi @Heku_ 

 

Could you please parsing the XML object to string using "toString()" funtion and then try to log Error and let me know if this works.

 

Regards

Akshay

Avatar

Correct answer by
Community Advisor

Hello @Heku_ ,

i have never used select all tbh. You can print result with JSON.Stringify(). Can you skip that selectAll?. Have you tried something like:

var res = query.ExecuteQuery();
var services= res.getElementsByTagName("service");

logInfo(services.length);
logInfo(JSON.Stringify(services));

 Do you have admin rights? Have you run the web app in admin mode? You can escalate admin rights for the query when you do not want to give admin rights to web app user.

 

Marcel Szimonisz

Avatar

Administrator

Hi @Heku_.,

Were you able to resolve this query with the help of the given solutions or do you still need more help here? Do let us know. In case the given solutions were helpful, then kindly choose the one that helped you the most as the 'Correct Reply'.
Thanks!



Sukrity Wadhwa