You need to sign in to do that
Don't have an account?
Test class for Trigger on AgentWork
We have a trigger on object AgentWork. We are trying create a test class for the same. While inserting test data, we get below 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]
Any inputs? Thanks.
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]
Any inputs? Thanks.
FIELD_INTEGRITY_EXCEPTION comes when you are assigning wrong Id to a field.
Ex:Populating contact Id for accountID.
Share the code.
Let us know if you have any problems.
Mark it as best answer if it works.
Thanks.
The issue happens because the Service Channel mentioned in code is associated with a particular Omni-channel status value.
When running the test class, my Omni-channel status was Offline, while the Service Channel is associated with 'online' status.
In order to resolve the issue, I made myself Online on Omni-channel and then ran the class. It was executed successfully.
Above could be one of the solution, but if anyone else has any solution, please feel free to comment.
Hi All,
Similar to the above but for different requirement i have tried by making me as "available" on omni-channel , it worked for my Developer org however while validating it to deploy through CICD on other org eventhough i did the same step. I am still getting the 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]
Please suggest. What can be done to resolve this?
Regards,
Anamika
I'm sorry