Restriction on Query within WebApp | Community
Skip to main content
Level 5
March 3, 2023
Solved

Restriction on Query within WebApp

  • March 3, 2023
  • 3 replies
  • 2744 views

Hi All,

 

I have created a WebApp, and need to know the folderName and folderId details, where the WebApp exist.

As those details are available in the nms:webApp schema, along with other linked schema, I am trying to query them in JS acitivity of our WebApp.

 

I tried hardcoding the formName value to the webapp internal name. In all the cases the query returns blank. Not even empty XML is returned. Are there any restrictions on query with WebApp

 

var formName = this.internalName; var query = xtk.queryDef.create( <queryDef schema="nms:webApp" operation="select"> <select> <node expr="[folder/@id]" alias="@folderId" /> <node expr="[folder/@name]" alias="@folderName" /> </select> <where> <condition expr={"@internamName ='"+formName+"'"} /> </where> </queryDef>).ExecuteQuery(); logInfo(query)

 Regards,

DG

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by akshaaga

@dipendu_g,

Regarding access rights, the user who is executing the query should have access to the "nms:webApp" schema and the folders where the web apps are stored.

In your case, it seems that your web apps are stored in the "Resources -> Online -> Web applications" folder. You should make sure that the user executing the query has at least read access to this folder and all its subfolders. You can check this by going to the "Security" tab in the "Administration" section and verifying the access rights for the user.

If the user does not have access to the folder where the web apps are stored, the query may not return any results or may only return results from a specific folder where the user has access.

 

3 replies

_Manoj_Kumar_
Community Advisor
Community Advisor
March 3, 2023

Hello @dipendu_g 

 

Make these three changes, and it will work.

  • change operation from select to get
  • In condition, it should be internalName instead of internamName
  • in logInfo use query.@folderId
     Manoj     Find me on LinkedIn
_Manoj_Kumar_
Community Advisor
Community Advisor
March 3, 2023

If it does not work after following those methods.

 

Then after making those changes. Try this

var myFolderId=""+query.@folderId+""; logInfo(myFolderId);

 

     Manoj     Find me on LinkedIn
dipendu_gAuthor
Level 5
March 3, 2023

Hi @_manoj_kumar_ ,

 

Tried both the options that you suggested. Its still coming as blank.

 

Regards,

DG

_Manoj_Kumar_
Community Advisor
Community Advisor
March 3, 2023

Hello @dipendu_g 

I found another issue.

 

this.internalName will not return the internal name of the webapp. This is why the result of your query is always blank.

     Manoj     Find me on LinkedIn
dipendu_gAuthor
Level 5
March 3, 2023

Hi @_manoj_kumar_ ,

 

Its returning the internalname for me.

But additionally, I had tried the query by hardcoding the internalname(APP381) as well. Still the same issue.

 

I also tried using the query without any constraints, and it only returns results from folder nms:TechnicalWebApp

 

Additional ref - that I am on ACC v8.

 

Regards,

DG

_Manoj_Kumar_
Community Advisor
Community Advisor
March 3, 2023

@dipendu_g 

Yes, This seems to be a v8 specific issue. This code works on v7 instance.

 

     Manoj     Find me on LinkedIn
akshaaga
Adobe Employee
Adobe Employee
March 3, 2023

Hi @dipendu_g,

There are a few potential issues with your code that could be causing it to return a blank query result:

  • Typo in the where condition: There seems to be a typo in your where condition, where "internamName" should be "internalName". This might be causing the query to not return any results.
  • Access rights: Make sure that the user executing the query has access to the "nms:webApp" schema and the folders that the web apps are stored in. You may need to check the access rights of the user executing the query in the "Security" tab of the "Administration" section.
  • Internal name: Make sure that the internal name of the web app you are trying to query matches the value of the "formName" variable. Double-check that there are no typos or differences in capitalization.

There could be other issues causing the query to return a blank result, such as incorrect syntax or missing values. You may want to try running the query in a separate environment, such as a query console, to see if there are any errors or issues that you need to address.

dipendu_gAuthor
Level 5
March 3, 2023

Hi @akshaaga ,

 

Point No 1 - was typo when I wrote the code here. Its already corrected.

Point No 3 - As I said, I even tried hardcoded internal name as well.

When I dont give any restrictions ( Where clause ) I only get results from a particular folder nms:TechnicalWebApp

 

Point No 2 - Which user should have access to those folders ? If you can be more specific, I can check.

My WebApps are under Resources -> Online -> Web applications folder. When the published WebApp is run on a browser, it run correctly. 

 

Regards,

DG

dipendu_gAuthor
Level 5
March 3, 2023

Hello All,

 

We need to give the webApp Agent access to the Web Application folders ( Read Access ) and it worked !!!

 

Thanks @_manoj_kumar_  and @akshaaga for your quick support and pointers

 

Regards,

DG