Issue with losing selected order data when executing script

My initial requirement started off as needing my own custom admin confirmation screen because I want to record what admin is confirming things like voids and returns.

So I built an awesome configuration that would work great if not for this issue/limitation I just got hit with. Seems like when you select an order and execute a script your order data is getting lost either inside the script im executing or after when the script executes another automation command and a rule picks it up and trys to apply the discount.

Here in the example I put the {SELECTED ORDERS} show message action in same rule as script executing just right before it. Then I put another same show message action in the rule that picks up the automation command executed from the script and it has no data in it. I did this to figure out why my discount was not applying.

It would help if you showed the actual rules and the script etc. But I am guessing something is being executed after order is already added and you lost the event. So your executing an ACM from inside the script? Via GQL or something else?

BTW if your executing a script you can feed all order data to script into variables and you wont lose anything.

I am curious but have you tried Tasks or Ticket Logs for this?

Yeah just an execute AC command from inside the script. Not GQL just a script feature. Yeah I know I can pass the order id in the script I just hate settling for workarounds as it’s not good practice to patch problems like that.

What do you mean by tasks or ticket logs? @VehbiEmiroglu I honestly think no one can argue with me that admin pin confirmations should report what admin confirmed it. For security purposes we need to know these kind of things.

1 Like

I did this, a custom confirm admin pin prompt which loggs the user as the state value for gifts and voids…
Posted screenshots maybe a month ago.

Okay looking at yours…

Will try and grab some screenshots later. Although I posted here…
Custom Confirm Admin Pin tutorial, used prompt and script/SQL to confirm priverlages.
Also used this to allow a seccond user pin for tablets without rfid.

1 Like

I’m not sure I understand this. A feature and how it works is not a problem.

Sorry that came off wrong lol, I think faster then I can write and mumbo jumbo comes out. I meant I try to aim for clean solutions with minimal code as its harder to break with updates and I would like to think is more reliable. If I pass in the Order ID I would have to reselect the order and add a few more actions to patch an limitation of losing order data.

Anyways looking at JTR solution. Seems like he has something that will work out form me.

@Hasa did you bypass this restriction?
I have the same problem.
I’m doing a setup now, “out of stock”.
which, using the script, will calculate how many products are needed for the execution of the order and the actual state of the warehouse.
the problem is to read all the orders, as the execution of the script resets “select orders” action.

ISSUE TEST

First test - show message

Rules:

Add First order:

Add next order (2,3,4…)

First test - WORK

Second test - Ecxecute script(show message)

Rules:

Script:

First order:

Next order (2,3,4…) - NOT show message:

Second test - DON’T WORK (not show second and next message)

UPD. LOL. i found solution.
using {CALL:X} instead execute script solves the problem
of course it is dirty workaround, but work.

Nothing dirty about that.
The only time I have used execute script is for returnless scripts on my PMS intergration which run sync scripts in the background. All other scripts use CALL in automation as want to continue further automation based on result like mark ticket as paid after charging to room etc or tell user there was an issue

CALL:X is a better method. You only use execute script when call:x cant be used.