1

I have tried to delete the record from VoiceCallRecording in the execute anonymous to test this functionality so that later on I can put the same in Apex class. I am the owner of voicecall record.

Here is the below code snippet.

List<VoiceCallRecording> vcr = [SELECT Id, Name, VoiceCallId FROM VoiceCallRecording where VoiceCallId = 'SomeIdOfVoiceCall'];

delete vcr.get(0);

and when I execute this, I get error like DML operation Delete not allowed on VoiceCallRecording

As per documentation of the VoiceCallRecording says that the delete() is allowed. Could anyone pls guide me through this, is there any permission set that needs to be enabled or anything that I am missing

url of the documentation https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_voicecallrecording.htm

1 Answer 1

1

Not all objects that can be deleted can be deleted from Apex. I haven't found specific documentation for why this might be true, but there is presumably a reason. If you need to delete a record, make a call to the REST API:

HttpRequest req = new HttpRequest();
req.setEndpoint('https://mydomain.force.com/services/data/v52.0/sobjects/VoiceCallRecording/Salesforce-Id');
req.setHeader('Authorization', 'Bearer '+UserInfo.getSessionId());
req.setMethod('DELETE');
HttpResponse res = new Http().send(req);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.