We need to force all agents who login into Service console to go online on OMNI Channel.


I know we can write a trigger on UserServicePresence object. But how do i cause the trigger on UserServicePresence object to run every time an agent logins into Salesforce So that it can set the agent to Online right away?


I know we can write a trigger on UserServicePresence object

According to this, you actually can't.

Apex triggers aren’t supported with UserServicePresence.

Sharing rules aren’t supported with UserServicePresence even if the OwnerId field is enabled.

In API version 41.0 or later, UserServicePresence records can be deleted programmatically. The “Customize Application” permission is required.

That being said, if you can access those objects via apex, I believe you could try to build a custom console component that could insert/update those records when the console is accessed:

Custom Console Components

The only thing I'm unsure of is whether or not the components can be developed to execute automatically or if users have to click on them to activate them.

Otherwise, Maybe a custom visualforce tab that is the default tab for the app that interacts with the records on page load could also work. My concern here would be that the console likes to preserve the user's state which means it may not automatically direct them to the page the first time they log in.

If you're in lightning you can try a lightning component but I'm not as familiar with adding those into the console app per-say. I couldn't find documentation to suggest there is a way to do this so you may still end up needing a VF page. Alternatively, you can develop the component in a way that it can be placed onto any arbitrary detail record page and add it to all the records your reps might view but you will need to be careful while developing it as it could flip the status mid chat which you may not want (make sure it only goes from offline to online for instance).

You'll have to play around to see if any of this will work for you.

  • thanks for you answer, But i was able to create a trigger on UserServicePresence Object in our sandbox. Maybe document is not updated. – Mike Y Jun 5 '18 at 14:50
  • Can you deploy the trigger to another sandbox via change set? I've seen instances where the error doesn't pop up until deployment. Also, that doesn't really erase the value of the other ideas discussed in the post so don't fixate on it. – gNerb Jun 5 '18 at 14:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.