blog image

How to calculate dynamically date minus constant in siebel expressions

We have a requirement to change the calculated expression for the created filed in the siebel batch jobs based on the enviroment. For the production enviroment the batch job selects records which were created for example 7 days ago to generate invoices. For the development and testing enviroment there is a requirement, to short this period because of testautomation which cannot wait.

We decided to use system preference constant to use for the calculation of the selected records based on created field.

Before following expression was used : Today() – 7. For the production enviroment we need to keep 7, for the testing and development enviroment we need to have it equal to 1. We decided to use siebel System preference to keep the constant and the system preference will be deployed for each type of enviroment with needed value.

Starting with PoC we have tried several expressions but without success. We want to share with the world the working expression , which is probably not documented.

The expression can be used in Siebel for :

  • Batch Jobs
  • Calculated Fields
  • Search Expression for the BC, Applets, Data Maps
  • Workflows

This is the prooved working expression :

[Created]<=ToChar(Today()-(0+SystemPreference("MOBITimeTestD")),'MM/DD/YYYY')

where MOBITimeTestD is the System Preference which decides how many days back are used to fileter the data.

We hope this will be of a help for you.

Before we begin: take a look at the processing of your personal data

If you visit a site that records cookies, a small text file will be created on your computer and stored in your browser. The next time you visit the same page, it will help you connect to the web faster. Our website will offer you relevant information and make it easier for you to work.

We mainly use cookies for anonymous traffic analysis and to improve our website. If you set your browser to block cookies, it is possible that the website will slow down and some parts of the website may not work completely correctly. More info on the processing of cookies.