07/31/2023 07:49 PM
Hi.
I want to assign enterprise role to user if the user's startdate is within 7 days.
How to set Technical Rule condition for this?
I tried with below condition, but both condition do not work well.
Users.startdate Less than sysdate()+7
Users.startdate Less than date(sysdate()+7)
Best Regards,
Solved! Go to Solution.
07/31/2023 08:39 PM - edited 07/31/2023 08:55 PM
a.statuskey = 1 and datediff (curdate(), a.startdate) between 0 and 7
07/31/2023 08:49 PM
Hi @KK
Please use the below query in the technical rules (use advanced query for this)
date(a.startdate) < curdate()+7
The above query provides all the users having startdate less than the current date + 7 days. But I would suggest you have the condition as below.
date(a.startdate) = curdate() + 7
Configure a user update rule, make this user update rule as a detective one. And re-run the technical rule on a daily basis to check the condition for users whose startdate will be in next 7 days.
Hope this helps! Let me know in case of any clarifications.
07/31/2023 08:49 PM
Hi @KK ,
Enable advanced config in your rule and use below query:
a.statuskey=1 and datediff (curdate(), a.startdate) between 0 and 7
08/01/2023 01:42 AM
Hi @pmahalle @naveenss @rushikeshvartak
Thanks all.
Bellow query seems to work.
a.statuskey = 1 and datediff (curdate(), a.startdate) between 0 and 7
But, there is still issue
With this query, if start date is today, the rule is run.
But, if start date is tomorrow, the rule does not run.
Tomorrow is within 7 days, so, the rule should run.
Do you have any idea?
08/01/2023 02:07 AM
Hi @KK ,
Ohh so you want 7 days ahead of the start date not behind. In that case use below query.
a.statuskey = 1 and datediff (curdate(), a.startdate) between -7 and 0
08/01/2023 03:30 AM
@pmahalle
Thanks, it works.