Expand my Community achievements bar.

Adobe Campaign User Groups are live now. Join our Adobe Campaign User Groups and connect with your local leaders!
SOLVED

Restriction on Query within WebApp

Avatar

Level 4

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

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

@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.

 

View solution in original post

12 Replies

Avatar

Community Advisor

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

Avatar

Community Advisor

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

Avatar

Level 4

Hi @_Manoj_Kumar_ ,

 

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

 

Regards,

DG

Avatar

Community Advisor

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

Avatar

Level 4

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

Avatar

Community Advisor

@dipendu_g 

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

 


     Manoj
     Find me on LinkedIn

Avatar

Employee Advisor

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.

Avatar

Level 4

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

Avatar

Level 4

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

 

 

Avatar

Correct answer by
Employee Advisor

@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.

 

Avatar

Level 4

Hi @akshaaga ,

 

Any documented way to get the internalName of the WebApp that is being executed within the JS Activity.

 

I am using this.internalName, is this the correct way ?

 

Regards,

DG

Avatar

Employee Advisor

@dipendu_g ,

Yes, using this.internalName should give you the internal name of the web app that is currently being executed within the JS Activity.

this.internalName is a built-in property of the WebApp object that refers to the internal name of the current web application.

So, using this.internalName is the correct way.