first error: FIELD_INTEGRITY_EXCEPTION, field integrity exception: []

Following insert statement on PendingServiceRouting object is failing with this error : System.DmlException: Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, field integrity exception: []

I have checked, the service channel id and case object id & they are being set to valid id’s. The error thrown by salesforce doesn’t say which on which field the error is being thrown. Please post if any ideas to resolve this error

PendingServiceRouting psrObj = new PendingServiceRouting(
                CapacityWeight = 1,
                IsReadyForRouting = FALSE,
                RoutingModel = 'MostAvailable',
                RoutingPriority = 1,
                ServiceChannelId = svcChn.Id,
                WorkItemId = c.Id,
                PushTimeout = 0
        );
insert psrObj;

Answer

I hit the same error trying to create a PSR for OmniChannel, and discovered that I had to include RoutingType field value for the PSR, and it had to be set to ‘SkillsBased’. (I would get the error if I set RoutingType to QueueBased or ExternalRouting).

Attribution
Source : Link , Question Author : Asif K , Answer Author : Delphine

Leave a Comment