How to filter date field as a user filter on record type?

Certified Associate Developer

Hi All,

I have a scenario where i need to filter the data from db based on the date. Filter values will be something like below.

Today

Yesterday

Last 7 days

FYI,

In Db,  date column is stored in date time format.

Can an someone suggest me how to achieve the filtering thing from db based on the date when db value is date time?

Thanks 

  Discussion posts and replies are publicly visible

Parents
  • Do you want to create User filter for Date Type...?, then you can create user filter by changing the type from list to Date range, and there you can select date range also, but there is one limitation here, this user filter will be applied to Record by Default.

  • 0
    Certified Associate Developer
    in reply to Geetha Satya Sree

    Hii Geetha satya sree

    this user filter was only work for past 7 days but i want all the seneiro like if i chick on today then according to today date my grid data filter and if i click on yesterday then yesterday created data display and then if i click last 7 days then past 7 days data display.

    Attact the image below:

  • I hope this code helps you, here we are using todatetime() function to convert today value, it will add 00 hours 00 MINUITE 00 Second's that is why when filtering with Today with today()+1

    a!recordFilterList(
      name: "Created On",
      options: {
        a!recordFilterListOption(
          id: 1,
          name: "Today",
          filter: a!queryFilter(
            field:'recordType!{b99dab82-8523-47ef-a91c-20d9b66ea668}PYEOS Candidate.fields.{103f0940-5ec7-44dc-8cf8-605b30db2fb7}createdon',
            operator: "between",
            value:  { todatetime(today()),todatetime(today()+1)}
          )
        ),
        a!recordFilterListOption(
          id: 2,
          name: "Yesteday",
          filter: a!queryFilter(
            field: 'recordType!{b99dab82-8523-47ef-a91c-20d9b66ea668}PYEOS Candidate.fields.{103f0940-5ec7-44dc-8cf8-605b30db2fb7}createdon',
            operator: "between",
            value:  { todatetime(today()-1),todatetime(today())}
          )
        ),
        a!recordFilterListOption(
          id: 2,
          name: "Last 7 Days",
          filter: a!queryFilter(
            field:'recordType!{b99dab82-8523-47ef-a91c-20d9b66ea668}PYEOS Candidate.fields.{103f0940-5ec7-44dc-8cf8-605b30db2fb7}createdon',
            operator: "between",
            value:  { todatetime(today()-7),todatetime(today())}
          )
        )
      },
      defaultOption: "Active",
      isVisible: true,
      allowMultipleSelections: true
    )

  • 0
    Certified Associate Developer
    in reply to Geetha Satya Sree

    Hii Geetha Satya Sree

    Thank u so much its working fine 

Reply Children
No Data