Hi Team,
I am facing issue with the probability filed while case flow moving. Here my requirement is whenever the case flow moves the probability value will also change automatically for automatic changing values i was return some code. whenever case flow is moving the values also changing automatically up to here it was working fine.But the thing is Here i am using two Business rule 1. make filed required 2.show filed on page based on case stage . while using this rules values was not changing automatically once u move the case flow then save the page again open or hard reload the page then only value is changing. can anyone please help me how to solve this issue.
Here the code in opppagev2 i used:
attribute:{
"Stage": {
"dataValueType": Terrasoft.DataValueType.LOOKUP,
"lookupListConfig": {
columns: ["MaxProbability"]
},
"dependencies": [
{
columns: ["Stage"],
}
]
},
},
methods: {
onEntityInitialized: function(){
this.callParent(arguments);
var oppStage = this.get("Stage");
this.set("Probability",oppStage.MaxProbability);
}
},
This two business rules i used in opppagev2
- make filed required
- show filed on the page
Thanks&Regards,
praveen
Like
The functionality can be implemented by overriding the save method in the OpportunityPageV2 schema. After changing the stage, the system automatically calls the "Save" method. Please feel free to use the "Save" method for modifying the Probability value. Here is the example below:
define("OpportunityPageV2", [], function() {
return {
entitySchemaName: "Opportunity",
attribute:{
"Stage": {
"dataValueType": Terrasoft.DataValueType.LOOKUP,
"lookupListConfig": {
columns: ["MaxProbability"]
},
"dependencies": [
{
columns: ["Stage"],
}
]
},
},
modules: /**SCHEMA_MODULES*/{}/**SCHEMA_MODULES*/,
methods: {
onEntityInitialized: function(){
this.callParent(arguments);
var oppStage = this.get("Stage");
this.set("Probability",oppStage.MaxProbability);
},
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);
}
},
/**SCHEMA_DATA_MODELS*/{}/**SCHEMA_DATA_MODELS*/,
diff: /**SCHEMA_DIFF*/[]
};
});