Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

can we call script include from business rule?

snajaykumar1234
Kilo Expert

if its yes, give me a example...

thanks

sanjay

10 REPLIES 10

Harsh Vardhan
Giga Patron

Hi Sanjay,



yes you can call. as you call any function same way you can call it.



var myCustomClass = Class.create();  


myCustomClass.prototype = {  


      initialize: function() {  


      },  


         


      myCustomFunction: function () {  


      ...  




Business rule should look like :



var myVariable = new myCustomClass();  


myCustomClass.myCustomFunction();  


Masarrat Siddi1
Kilo Guru

Server Side Script include can be called in BR. 

 

 

Thank You

Masarrat Siddiqui

Swarup Patra
Kilo Guru

var ApprovalEntitlementUtil = Class.create(); ApprovalEntitlementUtil.prototype = { initialize: function () { }, //on create approval, return the entitlement status returned by licensing API here onCreateApproval: function (usersysid, tablename) { try { var isEntitled = new sn_lef.GlideLicenseAPI().canUserApproveOnTable(usersysid, tablename); return isEntitled; } catch (e) { gs.log("Error with onCreateApproval: GlideLicenseAPI failure."); } }, //on adjudicate approval, return the entitlement status returned by licensing API here onAdjudicateApproval: function (usersysid, tablename) { try { var isEntitled = new sn_lef.GlideLicenseAPI().enableEntitlementLogging().canUserApproveOnTable(usersysid, tablename); return isEntitled; } catch (e) { gs.log("Error with onAdjudicateApproval: GlideLicenseAPI failure."); } }, type: 'ApprovalEntitlementUtil' }; nowKB.com

Harish Bainsla
Kilo Patron
Kilo Patron

Hi check below video you will understand

https://youtu.be/T9x4ZXAVurE?si=JfAzALO6S8RBCqYP

Swarup Patra
Kilo Guru

var ApprovalEntitlementUtil = Class.create(); ApprovalEntitlementUtil.prototype = { initialize: function () { }, //on create approval, return the entitlement status returned by licensing API here onCreateApproval: function (usersysid, tablename) { try { var isEntitled = new sn_lef.GlideLicenseAPI().canUserApproveOnTable(usersysid, tablename); return isEntitled; } catch (e) { gs.log("Error with onCreateApproval: GlideLicenseAPI failure."); } }, //on adjudicate approval, return the entitlement status returned by licensing API here onAdjudicateApproval: function (usersysid, tablename) { try { var isEntitled = new sn_lef.GlideLicenseAPI().enableEntitlementLogging().canUserApproveOnTable(usersysid, tablename); return isEntitled; } catch (e) { gs.log("Error with onAdjudicateApproval: GlideLicenseAPI failure."); } }, type: 'ApprovalEntitlementUtil' }; nowKB.com