Hi Community,
How can I override the dashboard list Name link, OOB functionality is opening its corresponding record but instead of this I want to put some logic and open other page. Where can I override this exact function? Any idea?
Like
Dear Fulgen,
Please see the article below on how to change the logic on the link click:
https://community.creatio.com/questions/show-captions-instead-absolute-url-links
Here is the way how you can override the dashboard:
1) Create your custom module that would extend Terrasoft.DashboardListedGridViewModel
Here is an example:
define("UsrDashboardListedGridViewModel", ["ControlGridModule"], function() {
Ext.define("Terrasoft.UsrDashboardListedGridViewModel", {
extend: "Terrasoft.DashboardListedGridViewModel",
getGridDataColumns: function() {
var gridDataColumns = this.callParent(arguments);
gridDataColumns.QualifyStatus = gridDataColumns.QualifyStatus || {path: "QualifyStatus"};
gridDataColumns.QualificationProcessId =
gridDataColumns.QualificationProcessId || {path: "QualificationProcessId"};
gridDataColumns["QualifyStatus.StageNumber"] =
gridDataColumns["QualifyStatus.StageNumber"] || {path: "QualifyStatus.StageNumber"};
return gridDataColumns;
},
getQualifyStatus:function(id) {
var activeRow;
if (id) {
var gridData = this.getGridData();
activeRow = gridData.get(id);
} else {
activeRow = this.getActiveRow();
}
if (!activeRow) {
return null;
}
var qualifyStatus = activeRow.get("QualifyStatus");
return (qualifyStatus) ? qualifyStatus.value : null;
},
addColumnLink: function(item) {
item.getQualifyStatusValue = function(qualifyStatus) {
if (!qualifyStatus) {
return null;
} else {
return {
value: qualifyStatus && qualifyStatus.StageNumber || this.get("QualifyStatus.StageNumber"),
displayValue: qualifyStatus.displayValue
};
}
};
return this.callParent(arguments);
},
applyControlConfig: function(control) {
control.config = {
className: "Terrasoft.BaseProgressBar",
value: {
"bindTo": "QualifyStatus",
"bindConfig": {"converter": "getQualifyStatusValue"}
},
width: "158px"
};
}
});
return {};
});
2) Create your custom module that would extend Terrasoft.DashboardListedGridViewConfig
Example:
define("UsrDashboardListedGridViewConfig", ["UsrControlGridModule"], function() {
Ext.define("Terrasoft.UsrDashboardListedGridViewConfig", {
extend: "Terrasoft.DashboardListedGridViewConfig",
generate: function() {
var config = this.callParent(arguments);
config.items[1].className = "Terrasoft.UsrControlGrid";
config.items[1].controlColumnName = "QualifyStatus";
config.items[1].applyControlConfig = { bindTo: "applyControlConfig" };
return config;
}
});
return {};
});
3) Create you custom module to override Terrasoft.DashboardGridModule:
define("UsrDashboardGridModule", ["UsrDashboardListedGridViewModel", "UsrDashboardListedGridViewConfig"], function() {
Ext.define("Terrasoft.configuration.UsrDashboardGridModule", {
alternateClassName: "Terrasoft.UsrDashboardGridModule",
override: "Terrasoft.DashboardGridModule",
viewModelClassName: "Terrasoft.UsrDashboardListedGridViewModel",
viewConfigClassName: "Terrasoft.UsrDashboardListedGridViewConfig"
});
});
4) Create your DashboardGridModuleWrapper, which enables UsrDashboardGridModule :
define("UsrDashboardGridModuleWrapper", ["BaseModule"], function() {
Ext.define("Terrasoft.configuration.UsrDashboardGridModuleWrapper", {
extend: "Terrasoft.BaseModule",
alternateClassName: "Terrasoft.UsrDashboardGridModuleWrapper",
constructor: function() {
var parentMethod = this.getParentMethod(this, arguments);
Terrasoft.require(["DashboardGridModule"], function() {
Terrasoft.require(["UsrDashboardGridModule"], parentMethod, this);
}, this);
}
});
return Ext.create("Terrasoft.UsrDashboardGridModuleWrapper");
});
5) Override BootstrapModulesV2 and add DashboardGridModuleWrapper to the dependencies:
define("BootstrapModulesV2", ["UsrDashboardGridModuleWrapper"], function() {
return {};
});