• Missing Debug
  • NEWBIE
  • 5 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 0
    Questions
  • 2
    Replies
Hi all

I have an after update Trigger which runs off AgentWork. If the WorkItemId of the AgentWork record is a Case and field AcceptDateTime changes, then the Trigger updates a field on the related Case.

Now, all of that works like a charm. However, writing a Unit Test Class for this has proven slightly tricky and I'm hoping someone in here can help me with that.

I keep getting this error: "System.DmlException: Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, The agent's status is not associated with the channel for this work.: [ServiceChannelId]"

The User inserting the AgentWork record in the Unit Test Class has a Profile which is coupled with our ServiceChannel and the AgentWork record I'm trying to insert has ServiceChannelId, WorkItemId (Id of Parent Case) and UserId (of User with correct Profile) set.

What am I missing?

Thanks in advance.

Søren Nødskov Hansen
Something Cloud
We're implementing a Salesforce LiveAgent chat and we would liketo have chat to appear in the bottom right corner of the page, in a layer, not a popup. My question is: is this even possible?

We have succeeded in plucking out the content of the chat popup and sticking it in an iframe which I position at the bottom of the page. However, upon reloading/navigating, the chat naturally needs to be re-opened and restarted by the visitor and the previous chat session is lost. This is not desired.

We have tried to get a session ID from the liveagent API, but that's not possible with an AJAX call since the API seems to be cross-domain protected for some reason (Ww can't send the headers the API needs). Luckily, one of our backend guys succeeded in getting a session ID via CURL. This is only step 1, however, as now I need to persist the ID of an ongoing chat and automatically reconnect to the same session when the user navigates.

So if it is possible to use LiveAgent chat in the way I have described it, how do I actually do it?
We're implementing a Salesforce LiveAgent chat and we would liketo have chat to appear in the bottom right corner of the page, in a layer, not a popup. My question is: is this even possible?

We have succeeded in plucking out the content of the chat popup and sticking it in an iframe which I position at the bottom of the page. However, upon reloading/navigating, the chat naturally needs to be re-opened and restarted by the visitor and the previous chat session is lost. This is not desired.

We have tried to get a session ID from the liveagent API, but that's not possible with an AJAX call since the API seems to be cross-domain protected for some reason (Ww can't send the headers the API needs). Luckily, one of our backend guys succeeded in getting a session ID via CURL. This is only step 1, however, as now I need to persist the ID of an ongoing chat and automatically reconnect to the same session when the user navigates.

So if it is possible to use LiveAgent chat in the way I have described it, how do I actually do it?