Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

how to call system properties in Script include

rajasekar reddy
Tera Contributor

Hi All, 

 

I have a requirement, 

 

I have created 3 new system properties and stored sys_id's of catalog item in each. I am trying to call the property from script include it is not working. Here my script. Can any one help on this.

var getcyberapproval = Class.create();
getcyberapproval.prototype = {
    getRITMSysId: function() {
        var software = gs.getProperty('software.onboarding.item');
        var nonSoftware = gs.getProperty('non.catalog.software.item');
        var group = gs.getProperty('cyber.security.group');

        var sys_ids = '';
        var ri = new GlideRecord('sysapproval_approver');
        ri.addEncodedQuery('sysapproval.ref_sc_req_item.cat_item='+software+'^ORsysapproval.ref_sc_req_item.cat_item='+nonSoftware+'^group.assignment_group='+group+'^state=requested');
        ri.query();
        while (ri.next()) {
            sys_ids += ri.sysapproval + ',';
        }
        return sys_ids;
    },

    type: 'getcyberapproval'
};

 @Ankur Bawiskar  please help me on this script

6 REPLIES 6

Hi @rajasekar reddy,

 

Try by adding log statements so you will get idea.

    var software = gs.getProperty('software.onboarding.item');
    var nonSoftware = gs.getProperty('non.catalog.software.item');
    var group = gs.getProperty('cyber.security.group');

    gs.info("software: " + software + "\n" + "nonSoftware: " + nonSoftware + "\n" +
    	"group: " + group);

 

Also, add the filter query in list view of sysapproval_approver table and make it dynamic based on variable values.

 

Thanks,
Sagar Pagar

The world works with ServiceNow

@rajasekar reddy 

I hope you are aware on how to add logs

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader