Discount per Custumer

I have Samba 4 Working ok, but for security issues need 2 new things that i could not find the way to do it.

First: I create a Custom Field on the Custumer Entity named Discont, the only thing that i need is when i chenge the client on the ticket, the compleate discount of the ticket apply, I know how to change the discount with the Action “Update Ticket Calculation” so I created a Rule Named “Update Discount” i used Event “Ticket Entity Changed” with the rule (Entity type Name Equals Customers) and that also works, i add the Action Update discount, and works ok if put the value of Discount manually, I only need to know how to make the system read the Custom Field “Discount” For the selected Client.

The Second thing that i need is that only admin can change the customers, so the Select Customer or Change Customer only works for Admin User.

I hope some body can help me with this simple issues.

To make the select and change customer buttons work only for admin you need to remove those entities from your ticket type so those buttons no longer appear

You then need to recreate those buttons using actions and rules so that you can map the automation command button to just the admin role

You cannot simply make those default buttons only work for admin, you need to recreate that flow using automation :slight_smile:

If your custom field is called Discount, you can access it using {ENTITY DATA:Customer:Discount}.

If you do that, remember nobody except an admin can add a customer to a ticket. If that is what you want:

I haven’t tested this but it should work.

Edit both Customer Search and Customer Tickets Entity Screens:

Set the Mapping to be for User Role of Admin.

That should stop those screens appearing at all for non-admin user and therefore they won’t be able to select or change the customer.

UPDATE: Just tested this and it works quite well.

Add ticket as non-admin, you can see Select Customer is disabled.

If Admin user has already added Customer entity to a ticket, non-admin user can still access the ticket with the customer entity selected, but cannot change or remove the customer entity from the ticket.

2 Likes

Didnt know you could map those :grinning:

1 Like

Hello, thanks for the fast replay,
I did the Mapping over a custom screen and works perfect,

But the discount for each client is not working, the thing here is the restaurant have many clients with difrent discount,
Client 1, 5%
Client 2, 12%
Client 4, 21.5%
This is the reason why we do not let waiters to change clients, they can change and give discount for people do not have an agreement.

Then to use the VIP system is not usable due need a lot of rules, one per client.

This is what I did:
I. I add a custom field on customer Entity

II. I add a calculation Type named “Discount”

III. I add an Action Type named “Update Discount” i try to add {ENTITY DATA:Custumers:Discount} in value, but did not work.

IV. I add Rule named “Update Discount”

What I am doing wrong??

Thanks.

Youve spelt Customers wrong, if youve kept the default name it should be Customers not Custumers

That was a finger error, i did well.
Did not work, if you see the pictures i did ok.
Where do i need to add the {ENTITY DATA:Customer:Discount}
on Rule or Action?

In the action you have it set to Remove Calculation as True… so it will remove any calculation.

Also have a look at my tutorial it does pretty much what you want, you nay need to change some automation but should help you

I did, if you see the pictures,

If you have it set as TRUE of course discount wont work… its removing the calculation. You remove something it means its not there anymore… you dont want to remove it you want to change it.

Try setting Remove Calculation as False. Then in the rule remove the action save it, reopen the rule and add the action back and set your parameter.

i want to remove the old calculation of other client,
i try removing calculation as False, and did not work.

If your wanting to change the rate… then removing calculation will not work… you simply need to change it to a new rate…

You did something wrong so we need to see more of your setup. Show us everything including the actual entity showing the rate.

where do i put the {ENTITY DATA:Customer:Discount} on the Action Value field or on the rule?

If you edited the action then it wont automatically update it in the rule. YOu have to remove it from the rule… save the rule then open the rule and add action back.

i already read that tutorial RickH, and works like te VIP Discount sistem, but to have a diferent discount for each client, it doesn’t.

Try what I just said above.

Why did you change where you put your rate? That wont work either… All I said was change it from True to False not to change the other variable.

Set your Amount back the way it was and set the action to False then remove the action from rule and add it back again.

Kendash,
Did not work, look pictures.


It probably did work but you cant see it yet. If you close the ticket and reopen the same ticket does it show new discount?