While fetching sharing criteria Rules I'm getting error System.CalloutException: Web service callout failed: Unable to parse callout response. Apex type not found for element includeRecordsOwnedByAll
MetadataService.MetadataPort service = new MetadataService.MetadataPort();
service.SessionHeader = new MetadataService.SessionHeader_element();
service.SessionHeader.sessionId = UserInfo.getSessionId();
MetadataService.SharingCriteriaRule sh=(MetadataService.SharingCriteriaRule)service.readMetadata('SharingCriteriaRule', new String[]{'SharingRuleName'}).getRecords()[0];
I also faced this same exception. Looks like a new element was added to SharingCriteriaRule by Salesforce that hasn't been addressed in the SharingCriteriaRule subclass.
While fetching sharing criteria Rules I'm getting error System.CalloutException: Web service callout failed: Unable to parse callout response. Apex type not found for element includeRecordsOwnedByAll
MetadataService.MetadataPort service = new MetadataService.MetadataPort(); service.SessionHeader = new MetadataService.SessionHeader_element(); service.SessionHeader.sessionId = UserInfo.getSessionId(); MetadataService.SharingCriteriaRule sh=(MetadataService.SharingCriteriaRule)service.readMetadata('SharingCriteriaRule', new String[]{'SharingRuleName'}).getRecords()[0];