- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2018 09:54 AM
I am trying to call a page redirect from the server side after I insert a record from a service portal widget. I want to pass back the sys_id I get from creating the record on the server side to the client side and redirect the users to the new URL. Right now I am storing the sys_id in the data.sys_id object. I am having issues on calling a client side function or detecting when the data.sys_id variables changes. I'm probably missing something simple, but any help would be appreciated!
Thanks,
Forrest
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2018 06:37 AM
Can you move your new “if” block inside the server.update().then Area? That part is what gets called asynchronously after your server script saves the record. I would put it right after spUtil.update($scope);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2018 06:37 AM
Can you move your new “if” block inside the server.update().then Area? That part is what gets called asynchronously after your server script saves the record. I would put it right after spUtil.update($scope);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2018 03:35 PM
Hi Jon!
Thanks for the response! You're recommendation worked perfectly! Know I understand that the .then is the callback function for the server update.
Thanks,
Forrest
Client Script
//Save all the data on the bundle
$scope.saveRecord = function(){
$scope.data.save_button_value = 'true';
//Set the input variables
$scope.data.short_description = $scope.short_description;
$scope.data.description = $scope.description;
$scope.data.name = $scope.name;
$scope.data.vendor_part_number = $scope.vendor_part_number;
$scope.data.price = $scope.price;
//Send the inputs to the server
$scope.server.update().then(function(response) {
spUtil.update($scope);
//redirect to new bundle
var srch = $location.search();
srch.id = "bundle";
srch.sys_id = $scope.data.sys_id;
$location.search(srch);
});
};