On click of an outcome how to avoid saving data?

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Senior Member

On click of an outcome how to avoid saving data?

Hello,

I have process with three task, in the first task i will enter the full name and submit it will go to next task that is second. the second task just displays the full name using display value, here i have edit outcome which takes to next task that is third. In the third task i will display full name using text box, here i have cancel outcome if changed full name different value with exiting value, when i click on cancel outcome the changes should not be saved just move to second task.

Anyone suggest me solution.

Thanks & Regards

Amruta Wandakar

1 Reply
Highlighted
Senior Member

Re: On click of an outcome how to avoid saving data?

I found my solution as follows


private cancelFormValues: FormModel;
formOldValues: any;
onFormLoaded(event) {
this.formOldValues = JSON.stringify(event.values);
this.formOldValues = JSON.parse(this.formOldValues);
}

if (event._outcome.name.toLowerCase() === "cancel") {
event.preventDefault();
this.cancelFormValues = new FormModel();
this.cancelFormValues = this.formOldValues;
this.formService
.completeTaskForm(this.currentTaskId, this.cancelFormValues, event._outcome.name)
.subscribe(
() => {
this.taskList.reload();
},
error => { alert(error); }
);

}