Autoassigned owner not visible as $TicketOwnerName during OnCreate

I have a queue with AutoAssign working, and I’d like to add a message into the Autoreply template telling the user which person has been assigned the ticket. But $TicketOwnerName is empty (and $Ticket->Owner() is 10, which is Nobody). I even moved the AutoAssign scrip above the autoreply scrip to no effect. The debug logs show that ticket creation only occurs after all the scrips have run, so I guess the ticket doesn’t have an owner until then? How can I provide this information to the user?

How are your scrips working? Do you have a scrip for autoassign on create and another one to autoreply on create?

Srip actions uses two steps “Prepare” and “Commit”.
Autoreply (based on SendEmail) is using “Prepare” to fill the template and sendit during the commit. Hence if both scrips runs on same condition, they will be first prepared one by one and commited. So your autoassign scrip action should use the prepare stage to really change the owner, so it is available for autoreply scrip action.

Either you write your on scrip action that does autoassign + autoreply (I think this is the way to do), or you first do the autoassign on create and then autoreply on Set+Owner (but you may trigger an auto-reply later when it’s not wanted). You can also modify your autoassign action to do everythin in “Prepare” stage.

Yeah, I have the default script to autoreply on create, autoassign is only on one queue, so merging them is trickier. How do I make a built-in scrip Action use the Prepare stage? The Action is Automatic Assignment, the User Defined conditions are all empty.

I had another read of TransactionBatchStage - Request Tracker Wiki and noticed that it says

In 4.2 you can even choose to run scrips in TransactionBatch mode on a per-queue basis.

so I unassigned the On Create Autoreply To Requestors scrip from the queue, and re-assigned it as a batch mode scrip, and now it works how I want (with $Ticket->OwnerObj->RealName).