Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

How to set Agent availability to "Available" every time they open the workspace application?

Mitchell Moses
Mega Expert

When an Agent clicks the workspace application link, I want to automatically set their availability to Available so the agents do not have to set this themselves. Anyone have any ideas if this possible?

1 ACCEPTED SOLUTION

Hi @Mitchell Moses ,

each time a user logs in an event is fired. With the help of a script action you can react on that event and set the availability. 

find_real_file.png

 

And for an easy copy and paste of the code:

var gr = new GlideRecord("awa_agent_presence");

gr.addQuery("agent", event.user_id.toString());
gr.query();

if (gr.next()) {
	gr.setDisplayValue("current_presence_state", "Available");
	gr.update();
}

Kind regards
Maik

If my answer replied your question please mark appropriate response as correct so that the question will appear as resolved for other users who may have a similar question in the future.

View solution in original post

11 REPLIES 11

Hi @Mitchell Moses ,

you have to create the Script Action in Global scope, but you created it in "x_g_irmc_dos_agent" scope. So the error is not a bug but the expected behavior of ServiceNow.

And no, there is not an event for opening the Agent Workspace.

Kind regards
Maik

Is there a way to fire an event from opening up a module link to be able to do what I want to do? find_real_file.png

Hi @Mitchell Moses ,

No, you in your case you could insert above code in a new UI Action and at the end of the UI Action you redirect the user to Agent Workspace.

Kind regards
Maik

They would be accessing from the module menu and not from a form. We have interaction,incident, etc we would have to put that Ui action on to click it. I'm not sure if that would work for us

 

find_real_file.png

Hi @Mitchell Moses ,

You got that exactly right, and I'm sorry there's no better solution. In ServiceNow thinking the legacy Agent Workspace is not a full replacement of the classic UI but a tool for a dedicated group of users (Agents), who would use it the complete day. Therefore, my approach with the login event.

Kind regards
Maik