Hi guys!
question is about how to properly set variable inside esq classic ui:
getAccountId:function(callback, scope){
var caseId = this.get("MasterRecordId");
var accountId = "";
// GET ACCOUNT ID
var esqCase = this.Ext.create("Terrasoft.EntitySchemaQuery", {
rootSchemaName: "Case"
});
esqCase.addColumn("Account.Id","AccountId");
esqCase.filters.add("AccountFiilter", Terrasoft.createColumnFilterWithParameter(
Terrasoft.ComparisonType.EQUAL, "Id", caseId));
esqCase.getEntityCollection(function(result) {
if (result.success) {
result.collection.each(function(item) {
accountId = item.get("AccountId");
callback.call(scope || this, accountId);
});
}
}, this);
// GET ACCOUNT ID
}
openBillingLineLookup: function() {
var Terrasoft = this.Terrasoft;
var caseId = this.get("MasterRecordId");
var accountId = "";
this.getAccountId(function(recordValue) {
accountId = recordValue;
console.log("account id",accountId);
}, this);
console.log("accountId after new func",accountId);// here is empty to due to async