Solved

FSM Business rule to compare datetime field

  • 3 November 2021
  • 2 replies
  • 332 views

Userlevel 3
Badge +6

Hi team , 

 

Can anyone tell me ,how can we write the input condition to compare the datetime field with current date and time in Business rule .

example : If the expiration date is on or before today date then business rule needs to fire .

I tried giving the input condition with less than and now() function ,but its not working.

 

Thanks

Muthujayashree R

 

icon

Best answer by Hasara Dinu 3 November 2021, 16:31

View original

2 replies

Userlevel 5
Badge +13

Hi @Muthujayashree,

Please refer the below example. You can use expressions to achieve this.

 

In the rule input, select the ‘USE EXPRESSION’ option without adding any table or column name

 

You need to add the below expression Inside the input parameters.

 

Expression = request.expiration_dttm<= Today()

 

Thanks,

Hasara

Userlevel 5
Badge +12

Hi @Muthujayashree ,

If your requirement is to validate the expiration_dt when the value is changed, you can write a client script and attach to the expiration_dt by mentioning the event as AfterValueChanged for Web Client and TextChanged for Smart Client. Note that the business rule triggers on the specified execution point (if its Before insert or update then the rule will triggered when pressing the save button) .

In the script you can get the specific expiration_dt value and compare with the the current date .

var now = new Date();

var dateOnly = formatDate(now, 'dateonly');


Hope this answer helps.

Best Regards,
Atheeq

Reply