Calling script include from business rule
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2022 05:38 AM
I have one requirement that copy case fields from case to incident for that i created one script include and am calling that script include from business rule. but it's not working. can anyone help me on this.
script include below
Business rule below :
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2022 05:44 AM
Hi @Rajesh Sheela1,
You have to pass the current object from business rule to Script include as a parameter. Use that parameter in script include.
Share your scripts here.
Thanks,
Sagar Pagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2022 05:48 AM
Script include :
var COPYCASEINC = Class.create();
COPYCASEINC.prototype = {
initialize: function() {},
COPYINC: function(current) {
var IncCp = new GlideRecord("incident");
IncCp.addQuery("sys_id", current.incident);
IncCp.query();
if (IncCp.next()); {
IncCp.u_asset = current.asset;
IncCp.u_account = current.account;
IncCp.u_product = current.product;
}
},
type: 'COPYCASEINC'
};
Business rule : it is running after insert and update
(function executeRule(current, previous /*null when async*/) {
// Add your code here
//var cpInc = '';
var sc = new global.COPYCASEINC();
sc.COPYINC();
})(current, previous);