here is the update portion of a ticket rule we use to randomly assign to two different owners:
Would be easy to pull a random 1-10 and then based on ranges assign to different owners as well.
We use this in conjunction with a select statement that forces our student workers to only be able to assign tickets to unassigned, themselves, or the two professional staff below. For example, if they try to assign a ticket directly to our CIO, the rule automatically randomly assigns the ticket to one of the professional staff below for review and escalation from there if needed.
Best, Tim
UPDATE HD_TICKET, USER as T5
set HD_TICKET.OWNER_ID = T5.ID
WHERE
(HD_TICKET.ID in (<TICKET_IDS>)) AND
T5.USER_NAME = CASE ROUND(RAND()) /*returns 1 or 0*/
WHEN 0 THEN 'FirstOwnerName'
ELSE 'SecondOwnerName'
END
UPDATE HD_TICKET, USER as T5
set HD_TICKET.OWNER_ID = T5.ID
WHERE
(HD_TICKET.ID in (<TICKET_IDS>)) AND
T5.USER_NAME =
CASE MOD(right((UNIX_TIMESTAMP(now())),1),2)+1 /*returns 1 or 2 based off timestamp*/
WHEN 1 THEN 'username1'
WHEN 2 THEN 'username2'
ELSE 'username2'
END - tholmes 8 years ago