back button issue within sub-process
Posted: Thu Feb 15, 2018 4:00 pm
I have it set up using a back button with the attached code. The js works fine on the main process, but once we go into a sub-process and use a back-button, it just brings up a "submit" button and it freezes once you click it. So you have to restart the case.
Code: Select all
$(document).delegate("#btn_back", "click", function (e) {
if (typeof localStorage["flagBackButton"] === "undefined" || localStorage["flagBackButton"] === "FALSE") {
showSpinner();
localStorage["flagBackButton"] = 'OK';
appUid = app_uid;
access_token = localStorage['pmAccessToken'];
server = localStorage["restServer"];
workspace = localStorage["workSpace"];
$.ajax({
type: 'POST',
url: server + '/api/1.0/' + workspace + '/plugin-psLeadRegistrationPlugin/back-button',
data: { APP_UID: appUid },
beforeSend: function (xhr) {
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.setRequestHeader("Authorization", "Bearer " + access_token);
},
success: function (e) {
spinner.stop(spinner_div);
pmRestRequest('GET', '/api/1.0/' + workSpace + '/cases/' + app_uid + '/variables', false, null, getCase);
},
error: function (e) {
console.log(e);
}
})
} else {
alert('Error: You can only go one task backwards!');
$("#btn_back").attr("disabled", "disabled");
localStorage["flagBackButton"] = "BLOCKED";
}
e.preventDefault();
});