Actions, Rules & Automation Commands Explanation

Im looking for some documentation on Actions, Rules & Automation commands.

So far all i have found is:
https://sambapos.com/wiki/doku.php/actions
https://sambapos.com/wiki/doku.php/rules
https://sambapos.com/wiki/doku.php/executing_commands_through_the_action_rule_system
https://sambapos.com/wiki/doku.php/automation_commands

But these have been practically useless.

I need to understand how to create actions and what kind of data can be passed.
If creating a new Entity via action, how to add custom data, how to get that data dynamically from an even in the first place. And many other things.

Does anyone have any documented explanations here?

Ive got a Pizza Delivery Setup, i need to generate coupons, promotions and vouchers. Setup everything in my particular way. I found the coffee shop(V3) example but thats not doing exactly what i need. Plus it doesnt seem to work properly on V5.

I need to trigger coupon creations when i update certain entities in the tickets, and store the Ticket ID and customer ID in the coupon Entity for backtracking. There are a few other important features that need to be built, but im quite lost here without any documentation.

Thanks.

OK, explain what your doing?
You want to update entity data field?
There is an action for that :slight_smile:

Can you define what you mean by [quote=ā€œdigithai, post:1, topic:11285ā€]
dynamically
[/quote]

You mean by user interaction?

Look at the [?Prompt] option, this does like an ask question with field and keyboard for user input of info, think that might be what you meanā€¦

Basically im trying to setup coupons. The idea was to generate a new coupon if the total amount is more than 1000 lets say.

Since its delivery only, i would like to generate the coupon when i assign a deliverer to a ticket. I would like to save the Customerā€™s ID and Ticket number into the coupon. So i made a Create Entity action. Now how do i pass the Ticket # and customer info to this action, and then how do i assign these values in the ā€˜Custom Dataā€™ field.

What rule is this action going into?

Iā€™m trying to trigger it with ā€˜Handle Deliverer Commandā€™ which is an automation command executed rule. This command adds my deliverer entity to the ticket.

I would ideally also need to calculate a time like 1 month from now and set that as the expiry date on the coupon.

OK, am going to need to be at my desk to discuss this,
If no one comes back in the mean time I should be home in 3-4 hours.

Thanks a lot JRTech! Really appreciate you taking the time to help me out.
Take your timeā€¦ if i manage to solve it on my own, will post my solution here.

I would wadger a solution for what your trying to do could be very similar to the native hotel account setup I did which used a automation command flow to create and update a seccond entity.
Your random coupon number would be the command value of an execute automation command going in to a coupon generation command rule.
Using the command value it would make the coupon entity, and then update entity data actions would update the required entity data again using the command value for the entity name.
There is allot more to the example that you will need but take a look and you might get the insparation to sort yourself before I get home;

There is a tutorial to print vouchers when a certain limit is reached so this may be a starting point for you.

But JTRTech is great at showing you how to implement the rest of the procedures or even show you other ways of doing this.

1 Like

Thanks!
Yeah i originally Implemented the Voucher thing, but realized i may need some unique IDs to them in order to prevent people from reusing vouchers. Works perfectly though this one. Then followed https://sambapos.org/wiki/doku.php/en/promotion_coupons_documentation .

seems almost there, but then again he has gone on to use a Product in the menu to generate the Couponsā€¦ So im trying to really just get something in the middleā€¦ Create coupons and discount vouchers with unique IDs and and auto generate them based on customer purchase history or total amount on current ticket.

JRTech has provided some massive content to look at and refer to, so will be studying that.

I use the voucher system i linked to produce vouchers and I have also got it inserting a ticket tag into the voucher with a random number and also the date and expiry dateā€¦ My system currently looks at the value of the ticket and then prints the voucher but if you want to link it to total spend of the customer over a certain period then you may be better off using Sambacard or similar system.

I dont use the create product system

1 Like

I am not a fan of the creating product method, seems unesercery to me but this is why a samba manual is imposible as there is no set way to do anything.

What type of coupons are these going to be?
They are not vouchers in a sense of having a credit balance?
If you can explain the use of cupons and how you plan to redeem them would help.

I created two Entities: Coupons & Vouchers

Coupons: Will be issued (example) if the customer bought 5 pizzas, it should generate a free pizza coupon. So i think following the coffee shop example almost gets me there. Will also have a few buttons in case of late delivery and all for free pizza or bread or something.

Vouchers: Will be issued for x amount like ā€˜500 worth voucherā€™. Vouchers will be generated when the customer spends more than a certain amount in a single order.

I think i can implement almost everything from the Coffee shop and the Voucher examples. My only issue is triggering and creating these coupons and vouchers with the ticket ID so that iā€™m able to print these out when iā€™m printing a receipt for the delivery guy to take to customer.

Do the coupons need to be tracked? If you print of a coupon would it say something like ā€œOrder 2 Pizza and get 1Freeā€?. personally i wouldnt want to track that as my coupon/voucher is printed on thermal 80mm paper and customers usually dont have something like that so wont be able to copy it. And if they did, at least they are coming back to your store for the pizzas :slight_smile:

Im not sure you would use Entities to do this but JTRTech can advise better

I think maybe we can discuss better my sugestion idea when I get home.

Just to keep things clear can we clarify some terminology so we are all on the same page.

An ORDER is a product/item line on a TICKET.
When you say customer spends so much on an ORDER I am presuming you mean TICKET.
I dont mean to be penicity but its better if we are all talking in the same way and that is the way things are called within samba so really the best way for us to refer to them.
A customers whole order is the TICKET, the things be has ordered are the ORDERS.

I too would personally like to track like you sugest.
This would also allow you to make a report to show the amount of unclaimed coupons. How much value to would place on a report like that is up to you but its a good thing to know I think.
Vouchers would obviously be tracked through their account. If your not using accounts I would recomend it that way myself.

We can go through my sugestions when I get home.

1 Like

ok @digithai am home.
so just recap what you currently have for coupons?

Any luck? The hotel entity setup give you any ideas?

good morning JTR, im working on it, things are starting to make more senseā€¦

Iā€™m located at GMT+7, so i had hit the bed last light. iā€™ll post my updates in a few hours.
thanks!

Ok, So i tried to read through the links properly and re-evaluated what im trying to accomplish.

So my current simplified conclusion to what i am trying to do is:

Coupons:
ā€¢ An Entity object with Unique ID, Redemption status, expiry date and Text Description.
ā€¢ On the Ticket screen, there will be an automation command (Button) ā€˜Issue Couponā€™. OnClick generates a popup that will ask for Description. This description will be saved into the New Coupon generated. So technically submission of the message triggers ā€˜Create Couponā€™ action which should be able to take the message as input. The created Couponā€™s code has to be returned and added to the Ticket so that it can be printed along with the Bill for the customer(When Deliverer is assigned).

Vouchers:
ā€¢ An Entity object with Unique ID, Redemption status, expiry date and Amount in numbers.
ā€¢ Vouchers will be auto-generated depending on the total amount in the ticket. This generation will have to be done as soon as i assign the Deliverer to the ticket. Again, voucher code will be printed along with the customer Bill.

Redeeming Coupons and Vouchers
ā€¢ Both Coupons and Vouchers will be redeemed by providing the code in the numberpad. If available, the coupon or voucher is assigned to the ticket.
ā€¢ For Coupon the Description will need to be displayed in the ticket header so the sales employee is able to read that and mark relative products free/gift and flag it with the coupon.
ā€¢ For Vouchers the amount has to be subtracted from the ticket as discount with the voucher code as the flag.

So thatā€™s my whole idea.
To implement this, im following these two tutorials:
ā€¢ Coupons: https://sambapos.org/wiki/doku.php/en/promotion_coupons_documentation
[The link i had shared earlier ā€¦ The Coffee shop example]
ā€¢ Vouchers: Printing Custom Discount Vouchers
[The Vouchers link from sid252uk]

So i currently need to figure out how to:
ā€¢ Create a popup text input, and submit this to a Create Entity Action.
ā€¢ set the date on the Create Entity Action.
ā€¢ Add discounts to the Ticket with some explanation text (Voucher ID)