How to call & extend script include in servicenow

Rajababu
Giga Guru

Hi ,

I want to extend one out of box script include "CSEMailUtil" it's out of box and I created my script include which extend OOB script include below sample code :

Client callable : True

var Getfunction = Class.create();

Getfunction .prototype = Object.extendsObject(CSEMailUtil, {


getValue: function(email) {
var value1 = '';
if (gs.nil(email))
return skills;
var emails = email.split(',');
emails = emails.reduce(function(filtered, mailId) {
if (mailId && !gs.nil(mailId.trim()))
filtered.push(mailId.trim());
return filtered;
}, []);

if (!emails || emails.length <= 0)
return value1;
var gr = new GlideRecord('sn_customerservice_channel_config');
gr.addQuery('email_address', emails);
gr.setLimit(1);
gr.query();
if (gr.next())
skills = gr.u_abc + '';
return value1;
},


type: 'Getfunction'
});

 

In email inbound :

 ((new CSEMailUtil).checkCaseChannel(email.to)) && ((new CSEMailUtil).isUserExist(email.from)) ---> do i  need to make changes into it ?

If yes then what ?

1 ACCEPTED SOLUTION

In email inbound I need to provide the as mentioned the get the content .

So in email inbound : It will be as it is where it will verify channel configuration email associated with with Valuefunction(field on the channel) .

Script include(extend into another script include) it provide accessibility to parent script include function :

"Getfunction .prototype = Object.extendsObject(CSEMailUtil, {"

Email inbound action (body):

current.valuefunction = new Getfunction().getValue(email.to);

GetFunction : Script include which extended to CSEMailUtil or another word which provided access to parent script include function .

getValue : Function defined into extend script include .

It working as desired .

View solution in original post

15 REPLIES 15

In email inbound I need to provide the as mentioned the get the content .

So in email inbound : It will be as it is where it will verify channel configuration email associated with with Valuefunction(field on the channel) .

Script include(extend into another script include) it provide accessibility to parent script include function :

"Getfunction .prototype = Object.extendsObject(CSEMailUtil, {"

Email inbound action (body):

current.valuefunction = new Getfunction().getValue(email.to);

GetFunction : Script include which extended to CSEMailUtil or another word which provided access to parent script include function .

getValue : Function defined into extend script include .

It working as desired .