Make action run within 7 days of a birthday

Want to offer our loyalty card customers a free drink on their birthday.

I can get all the actions rules setup etc I need but no idea what constraint I’d need in my action to run the system I want to set up.

Any ideas?

Sorry did from phone. Pics the wrong way lol

Not sure if there are helps in expressions but could definable be done in a script.

wondering if I need to use {ENTITY DATA:ShakesCard Customer Card:DOB}={+7{DATE:MM/dd}} or something?

As I said I do not know what helper fuctions are available on that level.
When I compair dates I generally find it easier to convert to time-stamp linux (the long number which is milliseconds since 1970 was it?) which then becomes a simple number for lager/smaller expressions.
So a day would be 246060*100 milliseconds.
But this might be less uefull for your use.

hmm, ok. if anyone could offer maybe sql to help that wouyld be awesome.

Obviously this is going to be beyond me.

fanx :slight_smile:

Explaine the flow?
What rule is this coming up in?

Wouldn’t need SQL, there might be a helper bit of nothing else would be able to put together a script for you if someone doesn’t offer solution before I’m next at PC?
Going to be Monday before I’m in front of my dev machine.

I haven’t done it yet, itll be through the ask question action within a rule.

So itll be upon entity selected and VIP Level =1

then ask Question Action with its own flow after, but I want the constraints of that action to only make it fire if its within 7 days of their birthday

So it’s on entity selected event so the day can be fed straight in from data field.
Just confirm the date format…
You have it masked so can only be that format?
What you want out of it? True/false?

its masked like that yes, don’t know - it needs to be 7 days either side. Then when its been used itll fill out the field on their entity to say that the free drink has been used which will prevent the question being asked again.

The used part should be easy as a seperate field updated when used just as an extra constraint on the first rule.

1 Like

yeah I can do that, I did it today.

I had a customer who said “ill pay the £10 loyalty at midnight when I get paid if that’s ok?” me being gullable said yes.

So today I made a new field in the entity called “Loyalty Paid” and it triggers off when its either yes or no.

If its yes then it ignores it, if its a no then it says that the loyalty isn’t paid and would you like to pay now? if yes is pressed it updates to a yes and opens a ticket with their entity selected. If they say No then it opens a ticket and removes their entity.

Ill do the same with the birthday with a field “Birthday Drink Used” and run the same yes no rules and stuff, not difficult now ive got my head around most of the program.

Only things I have trouble with is accounts and action constraints

thinking about it, I could use the rule constraint to fire the action?

Although when do you clear the value ready for next year?
Maybe if you put a value in for the year claimed so 2017 and then you can use a larger/smaller expression rather than a equals or not equals claimed.

loyalty runs from 1st july to 1st July so its just a case of resetting all of the fields

(probably a question later to do a find replace on sql)

Or a script to loop through entities, not a big deal.

1 Like

can you do that? I don’t know how to do that

Year easily, take a look at my loyalty sync scripts.
It does use SQL to get a list of entity names by type but script loops through them using the API helpers to drawer and change the info.
This was also a main component in the room entity data sync of my PMS setup so room entities showed names, package, occupancy and dates for the current in house bookings.

1 Like

Will have a look in the mornong when I get to laptop.

My AP will arrive in the mornong so I can get set up on the wifi

I had another go at my own scripting to auth a client on the unifi system and got a step further, just not had time to propper sit down.
If you want help with script for dates if can’t find alternative let me know and wil sort something.

1 Like