SetWorkFlow API is not honoured in the transform map


setWorkflow API is placed in transform map OnAfter scripts to not run any business rule on a third table when it gets updated based on the OnAfter script. There is a staging table in the data source and target table to run the transform. During the import, a third table which exists in another application scope is been called and updated in the On After scripts. Setworkflow API was placed in On-After script code to prevent BR from running on the third table in the scripts but this is not honoured

Sample code in On After script:

var reqsys='';
var gr = new GlideRecord("sc_request");
gr.addQuery("number", "REQ00xxxxx");
if ( {
gr.parent=" Sys id of the target table";
gr.autoSysFields(false); //Enable to disable automatic timestamping of system fields
gr.setUseEngines(false); // Enable or disable execution of engines


Release or Environment



This is expected behaviour of the platform . The transform map record is in one scope and the third table on which the update is performed using the On After script is in another scope.setWorkflow api cannot be set for cross scoped applications.

Exception reported in the log:

Security restricted: Access to api 'setWorkflow' from scope 'sn_customerservice' has been refused due to the api's cross-scope access policy



The workaround is to create a script include in global scope, add the script ( similar code in the On After script) in the script include and call the script include from the onAfter script of the transform map.