All examples in the documentation I have found for getting the omniToolkitAPI object in lightning show this being done via a lightning component, using a <lightning:omniToolkitAPI ...> aura tag in the component which is passed in to a javascript controller that makes the calls, for example here:


I need to support a situation where a notification arrives from an external service, and I need to react to it by setting the omni channel status for a user via the omniToolkitAPI, so there is no non-hacky way I can see to route this through a lightning component. Is there any way to get hold of the omniToolkitAPI object when the transaction is not triggered by a user action, without the need to use the <lightning:omniToolkitAPI ...> tag?

To cut a long story short, I need to be able to programatically set a user's status. I cannot immediately see a way to do this under Lightning, even though it's simple under Classic.


It sounds like you'll want to refer to Salesforce API Resources for External Routing in the Omnichannel documentation. You'll find links to additional resources to help you integrate partner applications with Omni-Channel including:

  • AgentWork
  • PendingServiceRouting
  • UserServicePresence
  • Streaming API Developer Guide
  • Streaming API Message Durability
  • Streaming API Limits

I suspect one of the 1st three is what you're looking for. Whether to use a SOAP call, a trigger, platform events or something else would depend on the particulars of your situation. The links should help guide you towards a solution.

| improve this answer | |
  • Thanks for this. Unfortunately it doesn't help. What I would need to do is create a UserServicePresence record, but it seems one is not allowed to do this, though when I saw what you suggested I thought this would work. The original reason I was trying to follow up omniToolkitAPI is that this would give equivalent support to what is available in Classic ... but in lightning there doesn't seem to be a solution. Frustrating. Unless I have misunderstood. – FatalFlaw Feb 13 '19 at 4:47
  • You didn't say exactly what you needed to do in your question, but I was thinking you could use Streaming API and/or Platform Events to update the UserServicePresence via a simple component since the API allows you to get the Presence. A new one by default is created with a status of IsAway=true. I doubt you could clone one. – crmprogdev Feb 13 '19 at 19:26
  • crmprogdev thanks. My understanding of the problem has evolved since I asked the question. Essentially what I want to do is create new UserServicePresence records, either via javascript or apex, in Lightning, without requiring actual user input. I can do it in Classic (developer.salesforce.com/docs/atlas.en-us.api_console.meta/…), just not lightning - there is an equivalent method, but the javascript object required doesn't seem to be available without an actual user action. DML inserts are not allowed on UserServicePresence. – FatalFlaw Feb 13 '19 at 19:32
  • 1
    I'm working on a new Lightning Console right now with many new components and features for a client. If I run across anything that might be helpful, I'll be certain to post back. – crmprogdev Feb 14 '19 at 18:00

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.