Display Date Fields only based on Stage in Reports

By | January 25, 2019

Sage CRM Reporting tool is an important feature of Sage CRM which is used to create simple as well as Complex reports within Sage CRM. Reporting tool has proved to be flexible enough to combine or customize various features such as displaying charts in report content, grouping the data, sort the data and so on. One such recent customization we applied on report’s search criteria screen was of displaying date fields based on the Stage value itself.

New Stuff: How to enable Export to PDF on Calendar List in Sage CRM?

Below are the steps that you need to follow:

1) Create a JavaScript page (e.g. ReportScreen.js) with below jQuery Code and place it in “<installation path>”\WWWRoot\js\custom” folder.

crm.ready(function()
{
var sReportName=””;
$(“a.TOPBC”).each(function(){
sReportName=new String($(this).text());
if(sReportName==”” || sReportName==”null” || sReportName==”undefined”)sReportName=””;
});

if(sReportName==”Your Report Name”)
{
//Stage
if($(‘#case_stage’))
{
$(“input[type=radio][name=’SelectOperatorscase_stage’][value=’SelectNotEquals’]”).closest(‘tr’).hide();
$(“input[type=radio][name=’SelectOperatorscase_stage’][value=’SelectEmpty’]”).closest(‘tr’).hide();
$(“#case_stage option[value=”]”).hide();
$(‘#case_stage’).change(function() {
OnChangeCaseStage();
});
OnChangeCaseStage();
}

//Created Date
$(“input[type=radio][name=’DateTimeModescase_createddate’][value=’IsEmpty’]”).closest(‘tr’).hide()
$(“input[type=radio][name=’DateTimeModescase_createddate’][value=’Relative’]”).closest(‘tr’).hide()
$(“input[type=radio][name=’DateTimeModescase_createddate’][value=’Operators’]”).closest(‘tr’).hide()
$(“input[type=radio][name=’DateTimeModescase_createddate’][value=’ForAny’]”).closest(‘tr’).hide()
//Registered Date
$(“input[type=radio][name=’DateTimeModescase_activateddatetime’][value=’IsEmpty’]”).closest(‘tr’).hide()
$(“input[type=radio][name=’DateTimeModescase_activateddatetime’][value=’Relative’]”).closest(‘tr’).hide()
$(“input[type=radio][name=’DateTimeModescase_activateddatetime’][value=’Operators’]”).closest(‘tr’).hide()
$(“input[type=radio][name=’DateTimeModescase_activateddatetime’][value=’ForAny’]”).closest(‘tr’).hide()
}
});

function OnChangeCaseStage()
{
//Stage
var sStage=””;
if($(‘#case_stage’))
{
sStage=new String($(“#case_stage”).val());
if(sStage==”” || sStage==”null” || sStage==”undefined”)sStage=””;
}

if(sStage==”Created”)
{
$(‘#case_createddate_start’).parent().parent().parent().show();
$(‘#case_activateddatetime_start’).parent().parent().parent().hide();

//Clear Value
$(‘#case_activateddatetime_start’).val(null);
$(‘#case_activateddatetime_end’).val(null);
}
else if(sStage==”Registered”)
{
$(‘#case_activateddatetime_start’).parent().parent().parent().show();
$(‘#case_createddate_start’).parent().parent().parent().hide();
//Clear Value
$(‘#case_createddate_start’).val(null);
$(‘#case_createddate_end’).val(null);
}
else
{
$(‘#case_activateddatetime_start’).parent().parent().parent().show();
$(‘#case_createddate_start’).parent().parent().parent().show();
$(‘#case_createddate_start’).val(null);
$(‘#case_createddate_end’).val(null);
$(‘#case_activateddatetime_start’).val(null);
$(‘#case_activateddatetime_end’).val(null);
}
}

2) Login to CRM. Report’s search criteria screen before adding the script will be as shown below –

3) Go to Administration -> System -> Metadata.

4) Check Refresh All checkbox and click on Execute Refresh button. Report’s search criteria screen after adding the script will be as shown below –

 

About Us –

Greytrix a globally recognized Premier Sage Gold Development Partner is a one stop solution provider for Sage ERP and Sage CRM needs. Being recognized and rewarded for multi-man years of experience, we bring complete end-to-end assistance for your technical consultations, product customizations, data migration, system integrations, third party add-on development and implementation expertise.

Greytrix has some unique integration solutions for Sage CRM with Sage ERPs (Sage Enterprise Management (Sage X3), Sage Intacct, Sage 100Sage 500 and Sage 300).We also offer best-in-class Sage ERP and Sage CRM customization and development services to Business Partners, End Users and Sage PSG worldwide. Greytrix helps in migrating of Sage CRM from Salesforce | ACT! | SalesLogix | Goldmine | Sugar CRM | Maximizer. Our Sage CRM Product Suite includes Greytrix Business Manager, Sage CRM Project Manager, Sage CRM Resource Planner, Sage CRM Contract Manager, Sage CRM Event Manager, Sage CRM Budget Planner, Gmail Integration, Sage CRM Mobile Service Signature and Sage CRM CTI Framework.

Greytrix is a recognized Sage Rockstar ISV Partner for GUMU™ Sage Enterprise Management – Sage CRM integration also listed on Sage Marketplace.

For more information on our integration solutions, please contact us at [email protected]. We will be glad to assist you.