Dynamics crm 为CRM网格着色
如何在Dynamics CRM 4上为CRM网格着色 我想在加载视图时自动显示带有背景色的实体列表Dynamics crm 为CRM网格着色,dynamics-crm,dynamics-crm-4,Dynamics Crm,Dynamics Crm 4,如何在Dynamics CRM 4上为CRM网格着色 我想在加载视图时自动显示带有背景色的实体列表 我的目标是根据所列实体的状态使用不同的颜色。例如,我希望为具有过去日期字段的案例设置一种颜色,为具有将来日期字段的案例设置另一种颜色。下面描述的解决方案是Microsoft不支持的更改(这意味着,使用它时要自担风险)。此外,也不能保证在应用CRM汇总时它不会被破坏 在CRM服务器上,修改C:\Program Files\Microsoft Dynamics CRM\CRMWeb\\ u stat
我的目标是根据所列实体的状态使用不同的颜色。例如,我希望为具有过去日期字段的案例设置一种颜色,为具有将来日期字段的案例设置另一种颜色。下面描述的解决方案是Microsoft不支持的更改(这意味着,使用它时要自担风险)。此外,也不能保证在应用CRM汇总时它不会被破坏
在CRM服务器上,修改
C:\Program Files\Microsoft Dynamics CRM\CRMWeb\\ u static\\ u grid\grid.htc
文件:
在initializeData()函数的末尾添加以下代码:
if (window.location.href.toLowerCase() ==
"http://CrmServerName:5555/OrganizationName/cs/home_cases.aspx") {
// We ensure that we are on the organization we want to colorize and that we
// are on the Cases page
var colorizeColumn = InnerGrid.FindColumnIndex("new_date");
if (colorizeColumn > 0) {
// We ensure that the column we'll use to colorize is present
for (var i = 0; i < InnerGrid.AllRecords.length; i++) {
// For each line
// Build the date value from the displayed date
var new_date_displayed = InnerGrid.AllRecords[i][3].
cells[colorizeColumn].innerText;
var new_date_value = new Date(new_date_displayed.substring(6,10),
new_date_displayed.substring(3,5) - 1,
new_date_displayed.substring(0,2),
new_date_displayed.substring(11,13),
new_date_displayed.substring(14,16), 0, 0);
// Get current date
var current_datetime = new Date();
if (new_date_value <= current_datetime) {
InnerGrid.rows[i].style.backgroundColor="ff0066";
} else {
InnerGrid.rows[i].style.backgroundColor="ff6600";
}
}
}
}
if(window.location.href.toLowerCase()==
"http://CrmServerName:5555/OrganizationName/cs/home_cases.aspx") {
//我们确保我们所在的组织是我们想要着色的组织,并且
//在案例页面上
var colorizeColumn=InnerGrid.FindColumnIndex(“新日期”);
如果(colorizeColumn>0){
//我们确保用于着色的列存在
对于(var i=0;i if(new_date_value@cja抱歉,我不知道,从来没有CRM 2011测试过它。