“Date” ing Tips

By | December 6, 2010

In my earlier post, I had explained how to retrieve date format of currently logged in user in SageCRM.

There have been numerous instances where the user needs a custom list page with the filter box and the standard way of doing this by using an existing filter screen. However the hitch here is that we have to take care of the filter button ourselves which means that once the user clicks on the filter button we have to generate the criteria to and pass this criteria to the list so that it shows only those set of records that meet the filter criteria.

The below section would slightly tend to curve on the technical side but I will try and keep it as “straight” as possible. You see, in case of lookup field in filter box there is no “contains” or “starts with” operator to search the records. You simply have to search whatever has been set in the lookup value and get the records to display in the list. But if the field in the filter box is a date field like a created date etc then it’s not so easy because with the date field Sage CRM provides a list of operators like between, relative etc as well.

Let me explain with an example. Suppose you have added Created Date (oppo_createddate) field in Custom filter box. Here the problem is to find the control name where the entry of options Between and Relative goes.

Well, DateTimeModesoppo_createddate control is created on the screen when you are adding the Date fields in filter box. Depending upon the value (Between/Relative) and reading the values of oppo_createddate_start and oppo_createddate_end, you can pass the same with custom filter criteria in an ASP page for filtering the list. While appending filter criteria you need to check user date format in your ASP page. The same is applicable for other date fields like Opened, Close By, Closed. The key here is to read the value and generate a correct SQL statement so that the right data in being displayed in the list.

So be in real world or Sage CRM you need to be well prepared for a date.

Note: Please click the images to enlarge them.
For queries regarding the functionality, please feel free to drop us an email at crm@greytrix.com.