AnsweredAssumed Answered

Validation Error in custom outcome

Question asked by amruta.w on Oct 7, 2018
Latest reply on Oct 17, 2018 by mauriziovitale

Hello,

 

I have designed the process as follows

In my html I have written code as follows

<adf-task-details
#activitidetails
[taskId]="currentTaskId"
(executeOutcome)="onExecuteOutcome($event)"
(formLoaded) = "onFormLoaded($event)"
(error)="customErrors($event)"
[showHeader]="false"
[showHeaderContent]="false"
[showInvolvePeople]="false"
[showComments]="false"
[showChecklist]="false"
[showFormTitle]="true"
[showFormCompleteButton]="true"
[showFormSaveButton]="false"
[showFormRefreshButton]="false"
[showNextTask]="true">
</adf-task-details>

 

 

In my typescript file of executeOutcome() i have written as follows

formOldValues: any;
onFormLoaded(event) {
this.formOldValues = JSON.stringify(event.values);
this.formOldValues = JSON.parse(this.formOldValues);
}
onExecuteOutcome(event) {
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); }
);

}
else {
event.preventDefault();
this.formService
.completeTaskForm(this.currentTaskId, event._outcome.form.values, event._outcome.name)
.subscribe(
data => {
this.taskList.reload();
},
error => {
let customErrors1 = JSON.parse(error);
let stringToSplit = customErrors1.exception;
if(stringToSplit == undefined){
this.snackBar.open(customErrors1.message, "ok", {
duration: 2500,
});
}
else {
let x = stringToSplit.split(":");
this.snackBar.open(x[2], "ok", {
duration: 2500,
});
}
}
);
}
}

 

After completing Task A, i will be navigated to Task B, when Task B is loaded this.formOldValues contains firstname and last name as blank. After filling the last name(this is required field), on click of cancel, the values must be blank and navigate to Task A but here i'm facing an error in console as follows

 

Here I have attached the my process design. Kindly anyone help me out regarding this.

 

Denys Vuika Maurizio Vitale

 

 

Thanks & Regards

Amruta Wandakar

Attachments

Outcomes