Skip to main content

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

 

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


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