Hi Team ,
I was created one own method in opportunitypagev2 and if i calling this method it is not working.Here my requirement is based on lookup value decimal value to be filled.
Here the code:
In this code onPropertyChanged is my method name.
If i placed this code inside onEntityInitialized function after save function and use this.onPropertyChanged(); means it is working but if i refresh the page then only decimal value is changing.
if i use this code not with in the onEntityintilized the whole method it self not calling.
define("OpportunityPageV2", ["ConfigurationConstants"], function(ConfigurationConstants) {
return {
entitySchemaName: "Opportunity",
attribute:{
"Stage": {
"dataValueType": Terrasoft.DataValueType.LOOKUP,
"lookupListConfig": {
columns: ["MaxProbability"]
},
"dependencies": [
{
columns: ["Stage"],
}
]
},
"UsrVertical": {
"dataValueType": Terrasoft.DataValueType.LOOKUP,
"dependencies": [
{
columns: ["UsrVertical"],
methodName: "onPropertyChanged"
}
]
},
},
methods: {
onEntityInitialized: function(){
this.callParent(arguments);
var oppStage = this.get("Stage");
this.set("Probability",oppStage.MaxProbability);
this.onPropertyChanged();
},
getStageEndStatusEsq: function() {
var esq = this.Ext.create("Terrasoft.EntitySchemaQuery", {
rootSchemaName: "OpportunityStage"
});
esq.addColumn("MaxProbability");
return esq;
},
setMaxProbability: function(){
var oppStageId = this.get("Stage").value;
var esq = this.getStageEndStatusEsq();
esq.getEntity(oppStageId, function(response) {
var stageItem = response.entity;
if (!(response.success && stageItem)) {
return;
}
var maxProbability = stageItem.get("MaxProbability");
this.set("Probability",maxProbability);
// console.log(maxProbability);
}, this);
} ,
save: function(){
this.setMaxProbability();
this.callParent(arguments);
},
onPropertyChanged: function() {
var budg;
var budgt;
var vertical = this.get ("UsrVertical").displayValue;
if (vertical==="Recruiting Companies")
{
budg=100000.00;
this.set("Budget",budg);
}
else if (vertical==="Recruiter Companies")
{
budg=100000.00;
this.set("Budget",budg);
}
else if (vertical==="Staffing Companies")
{
budgt=2000000.00;
this.set("Budget",budgt);
}
else {
budgt=0.0;
this.set("Budget",budgt);
}
},
},
If i use the same method after completion of above code this method is not calling.
/* onPropertyChanged: function() {
var budg;
var budgt;
var vertical = this.get ("UsrVertical").displayValue;
if (vertical==="Recruiting Companies")
{
budg=100000.00;
this.set("Budget",budg);
}
else if (vertical==="Recruiter Companies")
{
budg=100000.00;
this.set("Budget",budg);
}
else if (vertical==="Staffing Companies")
{
budgt=2000000.00;
this.set("Budget",budgt);
}
else {
budgt=0.0;
this.set("Budget",budgt);
}
},
*/
can anyone have idea how to figure out this issue and auto populate decimal value without refresh based on lookup values.
Thanks&Regards,
Praveenkumar
Like
There is a syntax error in the code (https://prnt.sc/pjmmtz). The name of the property should be "attributes" instead of "attribute".