Hello Team!
What is the way to use asyncValidate validation in Minipage correctly?
I have this code but is working in the page but no in the minipage of activities.
asyncValidate: function(callback, scope) {
debugger;
this.callParent([function() {
var Status = this.get("Status");
if (Status && Status.value == '4bdbb88f-58e6-df11-971b-001d60e938c6') {
var Notes = this.get("Notes");
var NoShow = this.get("SMNoShow");
if (!Notes || Notes == "") {
validationResult.message = "Please compleate notes.";
validationResult.success = false;
}
var esq = Ext.create("Terrasoft.EntitySchemaQuery", { rootSchemaName: "SMActivityObjective" });
esq.addColumn("Id");
esq.addColumn("SMAnswer");
esq.filters.addItem(
esq.createColumnFilterWithParameter(Terrasoft.ComparisonType.EQUAL, "SMActivitySubject", this.get("Id"))
);
esq.getEntityCollection(function(result) {
// create object to hold the validation result
var validationResult = {
success: true
};
if (result.collection.getItems().length > 0) {
var collection = result.collection;
var columns = {};
if (!collection.isEmpty()) {
collection.each(function(item) {
var answer = item.get("SMAnswer");
if (!answer && !NoShow) {
validationResult.message = "Please compleate all objectives";
validationResult.success = false;
}
});
}
}
// call callback function and pass object with validation result
callback.call(scope || this, validationResult);
}, this);
}
}, this]);
}The function is triggered but is not saving at all.
Thanks!

Like
2 comments
12:59 Oct 20, 2021
Hello Federico,
Try calling parent separately in your check. It will save the record successfully.
Best regards,
Oscar
Show all comments