Mapping Automation to Entity State

Hello All - well I have finally ventured into creating some simple workflows. I need some hep defining what can be or should be done in this scenario.

Entity Data and Scenario
[=TN(’{ENTITY DATA:Customer:Points}’)]>0

I want to enable (and/or) make visible an Automation button when a Customer Entity is Selected and the Customer has enough points to convert to dollars. The above example would be modified to say 250 points (>250).

The idea is Customer asks if he has any value in his points OR User swipes customer card to bring customer up and notices he can convert Points to $$$ and asks “would you like to convert your points to dollars today Sir…”?. Typically it would be during payment but I thought I would at least get this far as Payment requires Conversion and Account Transactions then Payment to Customer Account.

Ticket Screen
Looking at the debuuger both “New” and “Active” are just a Status and not state - correct?

State List

Action to Update Entity State

Rule used to Fire Action

Mapping

QUESTIONS
A. Can you create mapping just to an Entity without creating any Orders - I guess just in the “New” Status?

B. Even though we have 3 types - Entity, Order & Ticket - do the individual “Names” used in Mapping need to be Unique as how do you distinguish between a Order Status and a Ticket Status etc?

C. Do I need to create an Order State to Map this correctly as the rule debugger shows that Entity State is made to “Accrued”?

D. Can you specify [=TN(’{ENTITY DATA:Customer:Points}’)]**<=**0 (less than or equal to) in a constraint or do we need to use 2 lines or do we need to use the && clause?

E. When I used [=TN(’{ENTITY DATA:Customer:Points}’)]=0 the rule fired as well which is incorrect, what is wrong?

[EDIT]
F. How can I display a Dollar converted value in the “Convert Points” automation button caption?
For Example 350 Points = 350/250 = 1.4 Therefore we only convert whole dollars and show $1 ?

Generally folks once I get this away I should be ok to create complete workflows so looking forward to the answers, thanks.

Mapping a button? not following that one, automation commands would be relative to their position, ie order line would look to order state, ticket to ticket state.

If its right see above,[quote=“pauln, post:1, topic:8590”]
C. Do I need to create an Order State to Map this correctly as the rule debugger shows that Entity State is made to “Accrued”?
[/quote]
Again I think you would need to update ticket state for ticket visible command.

I asked in the past if you could map button to state isnot != but you cant, if that doesnt work its likely similar, mapping is positive/=

try [=TN(’{ENTITY DATA:Customer:Points}’)] == 0 or loose the TN … ‘{ENTITY DATA:Customer:Points}’ == ‘0’

Oh crap really , so if I have used “Display Under Ticket” then I must effect a Ticket State?
Don’t suppose there a place for Entity - I assume you are going to say an Entity Screen?
Interesting, what States do you effect if you have the button listed under “Payment Screen”?

Hey @JTRTech - thanks for completing another part of the puzzle!

So my remaining QUESTIONS are:

A. Can I dynamically change the Button Caption to “Convert Points” to “Convert Points to $ 5” the last bit being dynamic?

B. Where can I map a Automation in Ticket Screen or Payment screen just an Entity State? Trying to avoid the need to go to an Entity Screen?

C. What States do you need to effect for “Payment Screen” location visibility?

Since it is available grouped with ticket I would guess it is bound to ticket states.

Im pretty sure you can, would be surprised if not, the topics about menu buttons showing OUR OF STOCK based on dynamic product button headers - guessing same should be possible for automation commands if not it would be a good request.
Remember somewhere the <panel> tag could be used for dynamic button colour etc so expect {REPORT or {CALL:xx} will probably work…

If nothing else {CALL:xxx} works;

To see any states from ticket screen you would have to start a ticket. You would need to use entity screen if you don’t want tickets.

Yep Convert Points\r{ENTITY DATA:Customer:Points} works for me - now I just need to get the Rounding working in my display and Account Transactions…

Thanks you your help - invaluable.

Remember it won’t create a real ticket until orders are added and submitted. So you could manipulate entities and states and close ticket and no ticket will be made.

Thanks kendash - things are moving along now.

So if I convert Points will I use an Account Transaction Document or 2 Account Transactions? Are we inside a ticket even if its not a real ticket?

No that can be done with automation it won’t affect ticket.

Can this be done in a button caption?

Convert Points\r[=TN('{ENTITY DATA:Customer:Points}')]/2

Obviously I would like to display $5. The next issue is can I also use a ROUND function so 11/2 still gives us $5 and not $ 5.5?

Convert Points\r[=(TN('{ENTITY DATA:Customer:Points}')/2)]

Working, just need to consider the rounding now!

What are you rounding to? Down to nearest $

Just down so 2.5 becomes 2, 55.7 becomes 55 - so just losing the decimals and displaying the whole number?

Give me 5 mins…

Convert Points\r[=F(TN('{ENTITY DATA:Customer:Points}')/2,'#')] this gives me 5/2 displays 3. I just want it to display 2 as I not going to transfer part points…

Its only for display purposes, I will use proper calcs during the Account Transaction Document.

1 Like

Use a script and can use this;

Math.floor(NUMBER).toFixed(2)

Oh no you gone all script on me! Damn only have the slightly modified weather script so was doing my best to avoid as have done little javascript.

Will show you how to use, 1 sec