Decision Table script is not working in Scoped Application

sasikanth2
Tera Contributor
I have created a decision table in a custom scope and am trying to retrieve data from it using the provided code within a Business Rule and Scheduled Job. However, I am consistently encountering cross-scope access errors. Please advise on how this can be resolved.

 

Code:

    var response = '';

    var result = '';
    var inputs = {};
    inputs.enviro = 'Test env';
    inputs.u_property_variable_name = 'Test';
    inputs.u_property_name = 'Test Value';
    response = dt.getDecision('sys_id of Decision Table', inputs);
    result = response.result_elements.u_val1 + '';
    gs.info('Result:' +result);
 

Error:

Execute operation on API 'ScriptableDecisionTableAPI.getDecision' from scope 'Custom Scope' was denied. The application 'Custom Scope' must declare a cross scope access privilege. Please contact the application author to update their privilege requests.

 

I created Execute API cross-scope privileges for sn_dt.ScriptableDecisionTableAPI and sn_dt.DecisionTableAPI, with the target type set to Scriptable and status set to Allowed. Additionally, based on a community recommendation, I checked the Application Restricted Caller Access Privileges, but no related records were found.

 

Can anyone please help on this.

 

 

1 REPLY 1

Tanushree Maiti
Giga Patron

Hi @sasikanth2 

 

  1. Modify the status of Application Cross-Scope Access record:

 

Navigate to System Applications > Application Cross-Scope Access.

Filter the list where Status is Requested.

Locate the row showing your Source Scope (your Custom Scope) and Target Name as ScriptableDecisionTableAPI.getDecision.

Open the record, change the Status to Allowed, and click Update.

 

2.If it is not there , manually create it.

 

Navigate to System Applications > Application Cross-Scope Access ->Click New.

Fill out the form with these configuration details:

  • Source Scope: Your Custom Scope Name
  • Target Scope: Global
  • Target Type: Scriptable
  • Target Name: ScriptableDecisionTableAPI.getDecision
  • Operation: Execute API
  • Status: Allowed

 Click Submit.

 

3. Clear the cache by typing cache.do in navigator and test

 

 

Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti