0

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:

https://developer.salesforce.com/docs/atlas.en-us.api_console.meta/api_console/sforce_api_console_lightning_setservicepresencestatus.htm

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.

New contributor
FatalFlaw is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
0

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.

  • 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 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 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 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 2 days ago

Your Answer

FatalFlaw is a new contributor. Be nice, and check out our Code of Conduct.

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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