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

Mitchell Moses
Mega Expert

I want to come in to the homepage and have this be set to Available automatically

find_real_file.png

find_real_file.png

 

 

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.

Is there an event fired when a user clicks the agent workspace home menu button? I want them to become available when they get to the URL and not when they log into servicenow

 

Also your code throws this SetDisplay error in Logs