
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2021 11:16 PM
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 ?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2021 02:50 AM
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 .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2021 11:19 PM
Hi,
refer below link(s) for help
How to Extend the Script Include With Your Custom Made Script Include?
How to extend an existing Class in a new script include
How to Extend a Script Include
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2021 11:21 PM
Hi,
You've not really *extended* the CSEMailUtil as you're not invoking any of the CSEMailUtil functions nor overriding them.
What are you wanting to achieve?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2021 11:25 PM
I want to add one more method into "CSEMailUtil " oob script include .
Named "getFunction" .
There is existing email inbound action defined which utilize OOB functionality under condition .
In email inbound under condtion utlize CSEMailUtil() :
((new CSEMailUtil).checkCaseChannel(email.to)) && ((new CSEMailUtil).isUserExist(email.from))
Now How I can add filter for "GetFunction" under above script include .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2021 11:26 PM
Hi,
You can update the OOB Script include and add your custom function in it
CSEMailUti.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader