I am currently trying to build a schedulable class that will perform several operations based on a scope of AgentWork records.
However, on the creation of AgentWork records for the test class, I am receiving the
FIELD_INTEGRITY_EXCEPTION, The agent's status is not associated with the channel for this work.: [ServiceChannelId] error message.
I already took a look at similar questions such as Not able to create agentWork record in test class but didn't found any solution for the problem.
Below are the options I tried:
- Insert AgentWork without ServiceChannelId lookup -
FIELD_INTEGRITY_EXCEPTION, The agent's status is not associated with the channel for this work.: [ServiceChannelId]
- Insert ServicePresenceStatus record -
DML operation insert not allowed on ServicePresenceStatus
- Create ServiceChannel -
DML operation insert not allowed on ServiceChannel
PS.: Setting up the user running the test to Online on the Omni console while running the test is not an option as it would have to be done on the CI/CD process and that is not feasible.
Do you know if it is somehow possible to generate these AgentWork test records?
Best regards and thank you in advance!