Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2025 10:51 AM
Got it working.
I'm gathering the value of the 'location' variable on the catalog item. The client controller captures the value every time the value of location changes.
It then passes the location value to the server script.
In the server script I'm getting the sys_id of the catalog item from the URL.
I'm then passing the catalog item sys_id and location id to the script include.
The script does some stuff and passes back a value.
That value is then spit back over the client script which is put in a modal to display.
Server script
(function() {
var id = $sp.getParameter('sys_id');
var location = input.location;
doSomething(location,id);
function do Something(location,id){
var myUtil = new global.catalogHelper();
data.scriptIncludeResult = myUtil.calculateEstimatedDelivery(location,id);
data.message = data.scriptIncludeResult;
}
})();
Client controller:
api.controller = function($scope, spModal){
var c = this;
$scope.$watch(function() {
return $scope.page.g_form.getValue('location');
}, function(newValue !== oldValue) {
if(newValue)
c.data.location newValue;
c.data.action = 'getSomething';
c.server.update().then(function(){
var returnValue = c.data.message;
if(returnValue > '0') {
goToModal(c.data.message);
}
function goToModal(value){
spModal.open({
title: 'Estimated Delivery',
message: 'Estimated delivery for this locaiton for this catalog item is: ' + value,
buttons: [{
label: 'OK',
primary: true
}]
});
}
});
}
});
};