Hi I am having the scenario where i need to update the owner of the case to a particular queue. but i am getting the error as below :

System.DmlException: Update failed. First exception on row 0 with id 50018000009cO7BAAU; first error: FIELD_INTEGRITY_EXCEPTION, Service Request Owner: id value of incorrect type: 03g180000002N6QAAU: [OwnerId]

My Test Method :

 static testmethod void wmgAnnuityNotificationWebServiceTest(){

    //create cases
    List<Case> listCases = new List<Case>();
    List<Case_Associated_Document__c> docListForCase = new List<Case_Associated_Document__c>();
    List<String> listToPassDocNumber = new List<String>();
    Id recordTypeId = Schema.SObjectType.Case.getRecordTypeInfosByDeveloperName().get('WMG_Operations_Workflow').getRecordTypeId();
    QueueSobject wmgOpsFollowUpQ = [SELECT Id,QueueId,SobjectType FROM QueueSobject where Queue.Name = 'WMG Ops - Follow Up'];
    String caseListId;
    Case newCase = new Case();
    newCase.recordTypeId = recordTypeId;
    newCase.Type='New Application';
    newCase.Sub_Type__c='ML VA';
    //newCase.OwnerId = wmgOpsFollowUpQ.Id;
    newCase.Has_Hit_Follow_Up__c = false;

    insert listCases;

    for(Case oP :listCases){

    for(Case o : listCases){
        for(Integer i = 0; i < 2; i++){
            docListForCase.add(new Case_Associated_Document__c(Document_Category__c='TRANSFER', Document_Id__c='3790771', Service_Request__c=o.Id));
    insert docListForCase;

    for(Case_Associated_Document__c cF : docListForCase){
    //set up the mock response
    Integer statusCode = 200;

    SFG_WMGAnnuityNotificationWebService.CaseDetails cD = new SFG_WMGAnnuityNotificationWebService.CaseDetails(caseListId,listToPassDocNumber);

    String jsonBody = json.serialize(cD);
    Test.setMock(HttpCalloutMock.class, new MM_Test.HttpMockResponse(jsonBody, statusCode));
    update listCases;

1 Answer 1


You are getting this error because, the app you are using have no permission for Case Transfer and the logic which you are trying to implement have case transfer mechanism.

This problem can be overcome by proving Case Transfer permission.

Profile->App Permissions ->Transfer Case

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .