Calling Server side script from Client side in Service Portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2019 01:33 AM
HI Guys,
Good Afternoon.
I have created my basic SP widget. In that i have created a button named "Proceed". Once i click that button, then a request must be created in service-now. Here is the code i have written in server side. How to call this in client side? Can someone help me with code?
My widget Script is...
- Labels:
-
Service Portal Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2019 03:43 AM
Hi Vijay,

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2019 03:49 AM
Check this link
https://serviceportal.io/create-custom-action-buttons-service-portal/
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2019 05:38 AM
//HTML
<input type="submit" ng-click="onclickofProceed()" value="Proceed">
//CLIENT SCRIPT
function($scope) {
/* widget controller */
var c = this;
$scope.onclickofProceed= function(){
c.server.update().then(function(){
c.data.action='proceed'
})
};
}
//SERVER SCRIPT
(function() {
if(input.action =='proceed'){
var gr = new GlideRecord('incident');
gr.initialize();
//gr.requested_for = gs.getUserID();
//gr.short_description = "Order for desktop"
gr.insert();
gs.addInfoMessage(gr.number)
}
})();
please mark helpful/correct if that helped.
Thanks.