Replace Predictive Probability in Confidence Level Widget for Opportunities
Hello,
We have a customer that does not wish to use any ML models but relies heavily on manually updating the Opportunity Probability Field. They like the Confidence Level Widget but want the Predictive Probability piece of it to instead just show the Probability % from the Opportunity. Anyone have any ideas/thoughts on how to best do this?
Thanks,
Scotty Chapman
Blytheco
Like
Hello Scotty,
In order to achieve this, you would need to override the method getMetrics of the module ConfidenceLevelMixin. In order to do that, you need to create a new module and set it up like this
define("UsrConfidenceLevelMixin", ["terrasoft", "ConfidenceLevelMixin"], function(Terrasoft, ConfidenceLevelMixin) {
Ext.override(Terrasoft.ConfidenceLevelMixin, {
getMetrics: function() {
let metrics = [
{
"caption": this.get("Resources.Strings.DaysInFunnelWidgetCaption"),
"value": this.$DaysInFunnel
}
];
if (this.columns.PredictiveProbability) {
metrics.splice(0, 0,
{
"caption": this.columns.PredictiveProbability.caption,
"value": this.Ext.String.format("{0}%", this.get("Probability") || 0)
});
}
return metrics;
},
});
return {};
});
If we compare it to the original module ConfidenceLevelMixin, the change comes here
"value": this.Ext.String.format("{0}%", this.get("Probability")
So instead of taking the value from the predictive probability like this
this.$PredictiveProbability || 0
We take the value from the Probability field like this
this.get("Probability")
And then, considering that this is an ExtJS module, we need to create a replacing view module somewhere in order to attach our custom module to the page. For this case, we can create a replacing view module for the MainHeaderSchema, and set it up like this:
define("MainHeaderSchema", ["UsrConfidenceLevelMixin"], function() {
return {
attributes: {},
methods: {}
};
});
After that you should see the probability displayed in the widget.
Best regards,
Dariy
Hello Scotty,
In order to achieve this, you would need to override the method getMetrics of the module ConfidenceLevelMixin. In order to do that, you need to create a new module and set it up like this
define("UsrConfidenceLevelMixin", ["terrasoft", "ConfidenceLevelMixin"], function(Terrasoft, ConfidenceLevelMixin) {
Ext.override(Terrasoft.ConfidenceLevelMixin, {
getMetrics: function() {
let metrics = [
{
"caption": this.get("Resources.Strings.DaysInFunnelWidgetCaption"),
"value": this.$DaysInFunnel
}
];
if (this.columns.PredictiveProbability) {
metrics.splice(0, 0,
{
"caption": this.columns.PredictiveProbability.caption,
"value": this.Ext.String.format("{0}%", this.get("Probability") || 0)
});
}
return metrics;
},
});
return {};
});
If we compare it to the original module ConfidenceLevelMixin, the change comes here
"value": this.Ext.String.format("{0}%", this.get("Probability")
So instead of taking the value from the predictive probability like this
this.$PredictiveProbability || 0
We take the value from the Probability field like this
this.get("Probability")
And then, considering that this is an ExtJS module, we need to create a replacing view module somewhere in order to attach our custom module to the page. For this case, we can create a replacing view module for the MainHeaderSchema, and set it up like this:
define("MainHeaderSchema", ["UsrConfidenceLevelMixin"], function() {
return {
attributes: {},
methods: {}
};
});
After that you should see the probability displayed in the widget.
Best regards,
Dariy
Dariy Pavlyk,
That worked like a charm. Thanks so much!
Cheers,
-Scotty Chapman