Hi,
I will have to auto populate/bind a lookup column based on other column value.
My scenario is : I have added a lookup object UsrTerritory -- Values are Domestic & International
I have added a column with the above lookup reference in Account called "UsrTerritory".
This column should auto bind to domestic if the country is india, else to international.
In Edit page I have mentioned like
attributes: {
"UsrTerritory":
{
dataValueType: Terrasoft.DataValueType.LOOKUP,
dependencies: [
{
columns: ["Country"],
methodName: "GetTerritoryDetails"
}
]
},
},
GetTerritoryDetails :function()
{
//var Country = this.get("Country").displayValue;
var esqOrder = this.Ext.create("Terrasoft.EntitySchemaQuery", {
rootSchemaName: "UsrTerritory"
});
esqOrder.addColumn("Id");
esqOrder.addColumn("Name");
var DomesticValue,InternationValue;
esqOrder.getEntityCollection(function (result) {
if (!result.success) {
this.showInformationDialog("Data query error");
return;
}
result.collection.each(function (item) {
if(item.get("Name") === "Domestic"){
DomesticValue = item.get("Id");
}
if(item.get("Name") === "International"){
InternationValue = item.get("Id");
}
});
if(this.get("Country").displayValue ==="India")
{
this.set("UsrTerritory", DomesticValue);
}
else{
this.set("UsrTerritory", InternationValue);
}
}, this);
}
But am unable to achive in binding the column. It says undefined.
Please help