Cross scope Access best practice

UjwalaBedarkar
Tera Expert

Hi All,

 

I want to update the install group from the 'sn_ms_intune_spoke_sf_config' table to a custom field on the software model table which is in global scope.

I have create below business rule: 

Screenshot 2026-05-06 210935.png

BR code:

var IntuneToSAMUtils = Class.create();

IntuneToSAMUtils.prototype = {
 
    initialize: function() {},
 
    updateProductModelSupportLink: function(intuneAppSysId, installGroup) {
 
        if (!intuneAppSysId || !installGroup) {

            return;

        }
 
        var samModel = '';
 
        // Get model from Intune application

        var grApp = new GlideRecord('sn_ms_intune_spoke_application');

        if (grApp.get(intuneAppSysId)) {

            samModel = grApp.model;

        }
 
        if (!samModel) {

            return;

        }
 
        // Update Software Product Model

        var grModel = new GlideRecord('cmdb_software_product_model');

        if (grModel.get(samModel)) {
 
            // Avoid unnecessary update

            if (grModel.u_product_support_link != installGroup) {

                grModel.u_product_support_link = installGroup;

                grModel.setWorkflow(false);

                grModel.update();

            }

        }

    },
 
    type: 'IntuneToSAMUtils'

};
 

 

which call the script include from global scope

Script include:

 

(function executeRule(current, previous /*null when async*/ ) {
 
    // Add your code here
 
    var grpValue = current.install_group;
    if (!grpValue) {
        return;
    }
 
    var appl = current.application;
    var samModel;
 
    var grApp = new GlideRecord('sn_ms_intune_spoke_application');
    grApp.addQuery('sys_id', appl);
    grApp.query();
    if (grApp.next()) {
        samModel = grApp.model;
    }
 
 
    var grConfig = new GlideRecord('cmdb_software_product_model');
    grConfig.addQuery('sys_id',samModel);
    grConfig.query();
    if(grConfig.next()){
        grConfig.u_product_support_link = grpValue;
        grConfig.update();
    }
 
})(current, previous);
 

also added the cross access privilage record as below:

 

Screenshot 2026-05-06 211358.png

Just wanted to check if that a correct approach

1 ACCEPTED SOLUTION

Tanushree Maiti
Kilo Patron

Hi @UjwalaBedarkar 

 

You are on correct path .

Just ensure

  • Navigate to the 'sn_ms_intune_spoke_sf_config' table definition.
  • Under Application Access, ensure "Allow access to this table via web services and script include" is checked.

TanushreeMaiti_0-1778083134344.png

 

 

Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin:

View solution in original post

1 REPLY 1

Tanushree Maiti
Kilo Patron

Hi @UjwalaBedarkar 

 

You are on correct path .

Just ensure

  • Navigate to the 'sn_ms_intune_spoke_sf_config' table definition.
  • Under Application Access, ensure "Allow access to this table via web services and script include" is checked.

TanushreeMaiti_0-1778083134344.png

 

 

Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin: