Service Portal - Disable Leave Site?

ah16
Mega Expert

Hi,

I cloned form widget and keeps getting this leave site alert when I'm trying to click on save button of the form.

Any suggestions to get rid of this alert?

 

find_real_file.png

1 ACCEPTED SOLUTION

Hi,

on form we can get to know which fields got changed. but that is difficult on portal

can you try this just before navigation

window.onbeforeunload = function () {
  // blank function do nothing
}

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

11 REPLIES 11

You are welcome

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Ankur,

I found the issue and it is related to location.href which I have added to redirect after inserting record.

How can redirect without alert showing up?

$scope.$on("spModel.uiActionComplete", function(evt, response) {
$scope.submitting = false;
if (response.isActionAborted)
return;
var sysID = (response.isInsert) ? response.sys_id : $scope.data.sys_id;
location.href = '/tatm?id=tatmhome&confirmSysID=' + sysID;
loadForm($scope.data.table, sysID).then(constructResponseHandler(response));
});

 

Thanks,

Ashraf