Hi Team,
I'm trying to set a caption for a field dynamically in onNotificationsLoad: function(isPageable, items) of ProcessDashboardSchema (this schema is replaced).
I'm iterating a collection and finding a value via ESQ and try setting the caption to a field but its not executing. Then, i tried to see the value in console, the main function doesn't wait for the internal function to complete though i had used the callback.
NOTE: Please find the attachment for reference.
Thanks in advance!
Regards,
Bhoobalan P.
attributes: {
"connectedRecordCaption": {
"dataValueType": this.Terrasoft.DataValueType.STRING,
"Value": "ConnetcedRecord"
},
},
methods:{
onNotificationsLoad: function(isPageable, items) {
var opportunityName = "sample";
this.console.log("from loadNotifications function");
items.eachKey(function(key, item) {
this.getConnectedRecordName(item,function(response){
var entityID = response;
if(entityID){
this.getOpportunityName(entityID,function(response){
opportunityName = response;
this.set("connectedRecordCaption",opportunityName); (Not Setting)
this.console.log(opportunityName);
},this);
}
},this);
}, this);
this.console.log("after loaded");
},
getConnectedRecordName : function(item,callback,scope){
//Logic to Fetch the entityID
var esq = Ext.create("Terrasoft.EntitySchemaQuery", { rootSchemaName: "SysProcessEntity" });
esq.getEntityCollection(function (result) {
if (result.success && result.collection.getCount() > 0) {
var item = result.collection.getByIndex(0);
var entityId = item.get("EntityId");
callback.call(scope || this, entityId);
}
}, this);
},
getOpportunityName : function(entityId, callback,scope){
//Logic to Fetch the Opportunity Name
var esqActivity = Ext.create("Terrasoft.EntitySchemaQuery", { rootSchemaName: "Activity" });
esqActivity.getEntityCollection(function (result) {
if (result.success && result.collection.getCount() > 0) {
var item = result.collection.getByIndex(0);
oppName = item.get("OpportunityName");
callback.call(scope || this, oppName);
}
}, this);
},
}
diff:[
{
"operation": "insert",
"name": "ConnectedRecord",
"parentName": "ConnectedRecordContainer",
"propertyName": "items",
"index": 1,
"values": {
"itemType": Terrasoft.ViewItemType.HYPERLINK,
//Resources.Strings.customCaption
"caption": {"bindTo": "connectedRecordCaption"},
"click": {"bindTo": "onConnectedRecordClick"},
"classes": {
"hyperlinkClass": ["title-text-labelClass"]
},
"canExecute": {"bindTo": "canBeDestroyed"}
}
},]