• Jelle Hendriks
  • NEWBIE
  • 45 Points
  • Member since 2015

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 3
    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
Dear all, 

We're currently looking for a European/MiddleEast Salesforce developer with visualforce and data visualisation experience, experience with web technologies in general such as CSS, HTML, Javascript and Javascript libraries. Please contact me at jhendriks@suitsupply.com if you are interested.

Working remote may be topic of discussion, just as terms of the contract. 

Recruitment agencies will be ingored. 

Regards, 
Hi, 

We're looking for an experienced Salesforce developer for work within our marketing and service technologies department. We are a major dutch retail company working globally.

We expect you to be able to work minimal of 20 hours a week. Have a great understanding of APEX and Visualforce and have a proven trackrecord. 

Send your resume to jhendriks@suitsupply.com or send me a message on the forum.

Thank you in advance for your message. 

Regards, 


 

 

Dear all, 

We're currently looking for a Salesforce developer with visualforce and data visualisation experience, experience with web technologies in general such as CSS, HTML, Javascript and Javascript libraries. Please contact me at jhendriks@suitsupply.com if you are interested.

Working remote may be topic of discussion, just as terms of the contract. 

Recruitment agencies will be ingored. 

Regards, 

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