Specific Discount for Customers

Hi All

I want to setup simple discount system for loyal clients, I classify Clients into Silver & Gold and assign 5% and 10% accordingly.

I have gone through several tutorials in order to do this for the past 3days but am not getting results

Following are screenshots of what i did

  1. Transaction Type

  2. Custom Field - Name Class

  3. Calculation Type

  4. Action

  5. Rule

I have toggled between several information on the forum, can anyone assist?

Thank You

In your rule add Show Message action in message box enter: Customer Class {ENTITY DATA:Customers:Class}

If nothing show up, remove constraint {ENTITY DATA:Customers:Class} Equal Gold

So you dont get any result?
Few points;

Dont think you need :Customers: in the entity data expression as it knows customer based on thats its entity changed event.

You have rate of 0?

The calculation action specifies amount so not sure if inputting the desired % will work, you might need to have 3 calculation types to use like that… Not check tutorials and not used calculation like that yet.

What might be your issue is your transaction setup.
Its hard to tell as you seem to have custom accounts configured however a discount typically has receivable account/receivables as source…
So have you completely reconfigured your accounts?
Can you show your sale transaction account type?

Hello thanks for your support,

Do you mean i should add another action (Show Message) and enter ““Customer Class {ENTITY DATA:Customers:Class}”” ?

OMG… If you really go through a lot of tutorial Show Message is the most use action to debug, response to user…

No, I dont have an idea on show message

Its a common practice and used regularly for testing expressions such as your {ENTITY DATA:Customers:Class}.
You put it in this rule and remove the questionable constraint and put your expression in the show message or my preference ask question. Then when you do the event which triggers the rule it will show the result returned by the expression so you can check it returns as expected.
Somtimes certain expressions dont work in some events as dont have access to specifics - say an order detail on a ticket event as samba wouldnt know what order your refering to.

Here im using ask question to show the result of a report expression on ticket total changed event as wanted to calculate order states but needed to check the output was what i expected;

Show message works in a very similar manor.

Just create a generic action and ‘carry’ all the fields into the rule by using the square brackets and you can use it whenever you hit problems to check expressions.

  1. I want to use rates instead of amount. Should the rate be entered on Calculation type or on Action. Thats one of the areas am confused.
  2. I wanted to first try with one class, hence one calculation type, when i achieve results then i clone the others

Sales Transaction Type

Either should work. The idea behind putting the Rate in the Action is that you only need a single Calculation (and a single Rule), and then you set the Calc Rate using an Action [:variable] parameter in the Rule.

So your Update Ticket Calculation Action would look like this, using [:variable] parameters:

Your Calculation(s) would look something like this (the Rate/Amount can be 0 because we will set it in the Rule):

{ENTITY DATA:Customers:Class}

Regarding which one of those ^ to use, depends on the Rule in which the Tag is used. Some Rules can use either, while other Rules will only be able to access the Tag data using only one or the other.

So make a Show Message Action that you can use for testing and troubleshooting:

Put that Action in your Rule and remove the Constraint for {ENTITY DATA:Customers:Class}.

For the [:MessageToDisplay] variable parameter for the MSG TEST Action in your Rule, put this:

Class:{ENTITY DATA:Customers:Class}\r{ENTITY DATA:Class}

Now invoke the Rule and see which of the Tags in the Message dialog gives you a Result. Use the corresponding Tag for your Rule Constraint.

FYI, as it turns out, the Ticket Entity Changed Event, requires the Tag that uses the Entity Type, so you need to use this:

{ENTITY DATA:Customers:Class}

Finally, your Rule might look like this:

Once you are confident everything is working as expected, you can remove the MSG TEST Action from your Rule.

1 Like

Like this?

You need to put square bracket expression in the action like [:MessageToShow]
This then alllows the setting on the message from the rule as the field for message will then be available in the rule as MessageToShow field.

Remove the action, save the rule then edit the action then add back to the rule and put the Class:{ENTITY DATA:Customers:Class}\r{ENTITY DATA:Class} in the MessageToShow field.

Great, thanks to all. I have desired results from the above solution. Thank You

Please share your solution/results and support the forum community and help others that may end up in your position :slight_smile: