How can I get the current user and current department and give it as a parameter for an action?
For example, if I wanted to create a Display popup action which shows me the current department (or current user), what would I have to put in the “Message” field of the Display popup action?
I tried many values, but none seem to work:
{DEPARTMENT}
(this was the closest, gave me “[UNDEFINED]”)
{:DEPARTMENT}
(empty)
{CURRENTUSER}
(shows “{CURRENTUSER}”)
{:CURRENTUSER}
(empty)
{USER NAME}
(doesn’t do anything, action doesn’t execute)
{:USER NAME}
(empty)
{SETTING:CURRENTUSER}
(empty)
{SETTING:USER NAME}
(empty)
{SETTING:DEPARTMENT}
(empty)
So there is no way to decide what the current department (or user) is outside of the ticket screen?
I would like to create a program setting with department and user values inside, so that I can call outside scripts for additional functions with these parameters. I would do that from a separate admin screen when there’s no ticket open.
I could set that program setting during ticket creation, but even then, it would be impossible to know if the user has changed the department (or logged on/off) since the setting was last updated.
Are these settings stored in the database somewhere that I can get it, or any other way to do it?
Nearly everything is stored in the DB, but due to the way elements are linked together, not all settings are available to all events.
For example, the event for User Login has access to [:Username] or {USER NAME} and [:RoleName], which is how I can set the Application Title:
But as you can see, the Department is not available until we create a Ticket, since the Department is linked to a Ticket Type. Even [:TicketTypeName] is not available on Login; it only becomes available after a Ticket is created (Order added).
Anyway, when I type it right, it also doesn’t work:
So in V4, using this syntax, does it show the department and user even when there’s no ticket or is it just another way to write {USER NAME} and {DEPARTMENT}?
That was why I’ve said V4 will work better because these values stores in cache and navigating to Manage screen clears cache. I’ve recently changed for V4 how it stores these values.
I see, that explains (and provides a partial solution).
I set the isLocal parameter of Update Program Setting to false so it stores it in the database instead of the cache, as you just explained in
and now the user name doesn’t disappear anymore after going to the Manage screen.
Now I just need to find a way to do the same for the department name.
Is there an event where I can catch when someone goes to the Manage screen, or an event where I can catch {:DEPARTMENT} before that?
Maybe the “Application Screen Changed” event? How does this event work? What are the possible values for CurrentScreen and PreviousScreen?
Does the flushing of cache happen before or after this event?
So just set constraint CurrentScreen - equals - Management
for a rule to work when entering the Management screen
or
PreviousScreen - equals - Management
for a rule to work when leaving the Management screen