How to get application scope in an Experience page?

thomaskennedy
Tera Guru

I have a data broker that returns some details about the most recent import set created for a given Scheduled Data Import, so I can configure a List control to display its content. I want to pass that broker the name of the import, but also the scope, so I do not get information back on some other import set. So as a first step I pass in the name of the import:

 

[
{
"name": "scheduled_data_import_name",
"label": "Scheduled Data Import name",
"description": "Name of the Scheduled Data Import for which you want the most recent import set",
"fieldType": "string",
"mandatory": true,
"defaultValue": ""
}
]

And in the data broker script I tried to use gs to get the application scope:

var gr = new GlideRecord("scheduled_import_set");
//gr.addQuery("sys_scope", gs.getCurrentApplicationScope());
gr.addQuery("name", input.scheduled_data_import_name);
gr.setLimit(1);
...

But when I do that I get an error mesage in the log saying getCurrentApplicationScope is not allowed here.

So my next thought was to pass in the scope from my page. But I do not see scope available on the properties, only app id.

So how can I get the current scope into, for example, a client state variable so I can pass it as an additional param, to be sure I get the right import set?

I suppose I could set up a Tranform data resource to return it, but that seems roundabout.

 

 

5 REPLIES 5

I would use that, and compare it to the sys_package value in my scheduled script, but I do not see how to obtain it from my Page.

The page properties expose something call app_id (which is not the same value returned by gs.getCurrentApplicationId()), but that does not appear in the XML of my scheduled script.

thomaskennedy_0-1741632760655.png