Skip to main content
17 votes
Accepted

Deleting (or Renaming) Custom Metadata Object / Custom Object yields Insufficient Privileges

This is an issue under investigation by SFDC R&D that apparently affects some customers and is not limited to just Custom Metadata deletion (affects also Custom Object deletion including hard ...
cropredy's user avatar
  • 73.3k
13 votes

How to delete AsyncApexJob with Queued status

In case Phil's solution doesn't work, and you are stuck with a zombie Queued AsyncApexJob, here's a workaround: At Version 39.0, an attempt to delete a zombie Queued AsyncApexJob that has no ...
cropredy's user avatar
  • 73.3k
12 votes
Accepted

Is the LastModifiedDate of a deleted record the date that it was deleted?

Thanks to @AdrianLarson for the suggestion, but SystemModStamp got me the same answer as LastModifiedDate. The user with the anecdote has just confessed to being confused and misreporting the ...
Aidan's user avatar
  • 14k
11 votes

How to delete a class from production using destructiveChanges.xml

From this blog To achieve this via Workbench, create a folder on your desktop. I will call my folder ‘deleteClasses’. Then go to Notepad (or another text editor) and copy and paste the below and save ...
sfdc's user avatar
  • 13.8k
10 votes
Accepted

Delete an SObject by knowing only Id

Yes, you can delete an object knowing only its Id. If you know the object's type at development time, you can initialize an sObject instance with the Id and supply it to the delete DML operator, as ...
David Reed's user avatar
  • 93.7k
9 votes
Accepted

How can I delete a contact which was associated with a customer portal user?

Just to add to @John Thompson's answer, you can add the button that disables the customer user: This will remove the connection between the user and the contact, and mark the user as deleted. If you ...
Itai Shmida's user avatar
  • 5,065
8 votes

Mass delete Debug logs using Salesforce DX

The following worked fine for me in MAC sfdx force:data:soql:query -q "SELECT Id FROM ApexLog" --resultformat csv > out.csv sfdx force:data:bulk:delete -s ApexLog -f out.csv I have not ...
Mohith Shrivastava's user avatar
7 votes
Accepted

Before Delete Trigger, Need to Delete Linked Record, getting "De-reference Null Object" Error

This is happening because Trigger.new is not available on before delete context. You'll want to use Trigger.old instead. Check this document about Trigger Context Variables.
Renato Oliveira's user avatar
7 votes
Accepted

How to Delete a Data Extension Folder

Try to delete it from Email Studio: Go to Email Studio > Subscribers > Data Extensions and right click on the folder.
zuzannamj's user avatar
  • 14.5k
7 votes
Accepted

Delete classes/trigger from Prod via VSCode

The UI option currently does not support deletion of metadata from production (e.g. see this question) What you need to do is a normal metadata API deployment instead. Create a new folder in your ...
sfdcfox's user avatar
  • 502k
7 votes
Accepted

Mass delete Debug logs using Salesforce DX

The following worked for me sfdx force:data:soql:query -q "SELECT Id FROM ApexLog" -r "csv" | out-file -encoding oem out.csv sfdx force:data:bulk:delete -s ApexLog -f out.csv With ...
Pmanglani's user avatar
  • 158
5 votes
Accepted

How can we find out the deleted record in After delete trigger?

To get or Query deleted records you need to use ALL ROWS So your query will be List<Object__c> deletedRecords = [SELECT Id FROM Object__c WHERE ID IN :lstTriggerOld AND ID NOT IN : ...
Tushar Sharma's user avatar
5 votes

Remove elements from Map based on records in another map

A clear and efficient solution would be by using keySet() and removeAll() methods. Explanation: map.keyset() will return a reference to the set of keys of the respective map, enabling the interface to ...
Jasneet Dua's user avatar
5 votes
Accepted

Remove elements from Map based on records in another map

You can use the remove() method: Map <String, String> mapOne = new Map <String, String>(); mapOne.put('key1', 'value1'); mapOne.put('key2', 'value2'); mapOne.put('key3', 'value3'); mapOne....
Boris Bachovski's user avatar
5 votes

Deleting Custom Objects

When you go to the "Custom Fields & Relationships" section of the custom object definition, there will be a bold link labeled "Deleted Fields (#)". If you click on that link, it will take you to a ...
martin's user avatar
  • 12.7k
5 votes

Does Database.SaveResult, Database.DeleteResult, etc. implement a public interface?

No, they do not implement a common interface. As a workaround to this, I created a wrapper class that does this: class DmlResult { Id recordId; Integer rowIndex; Boolean success; ...
sfdcfox's user avatar
  • 502k
5 votes
Accepted

How prevent deletion in Event delete trigger and update a field instead

You cannot convert the delete event into an update. Once the DML operation has been started, you can block it (and potentially roll back the transaction) by adding an error on the record. That's ...
David Reed's user avatar
  • 93.7k
5 votes
Accepted

Does contact deletion in marketing cloud also removes email tracking data?

The information will remain in the system - but in unrecognizable format. Contact deletion does also not remove the Contact (any any related information) from your custom non-sendable Data ...
Rain's user avatar
  • 5,794
5 votes
Accepted

Error not bubbling up from delete trigger

You will need to use Trigger.old in case of delete operation to be able to display your custom error message. This is from the Trigger Exceptions documentation (emphasis mine): Triggers can be used ...
Jayant Das's user avatar
  • 30.7k
5 votes

ERROR: must implement the method: System.Iterable<SObject> Database.Batchable<>.start(Database.BatchableContext)

It's a weird behavior with the compiler. Change it to Database.Batchable<sObject> instead. Notes: You don't need to copy the list before deleting it. Use an inline query. Don't query fields you ...
sfdcfox's user avatar
  • 502k
5 votes

Can't delete flow version because it's referenced by deleted flow interviews

I ran into this issue, although I had no paused flow intervals. Salesforce has saved failed flow interviews which would not let me delete my flow. Solved by navigating to Setup -->Paused and Failed ...
Chelsea Kaplan's user avatar
4 votes

Validation rule prevent user deleting record in pipelines?

The only way to validate deletion is with an Apex Trigger. To validate a record and prevent its deletion, you need to call addError. The most basic working structure would look like: trigger ...
Adrian Larson's user avatar
  • 151k
4 votes

Delete a managed release package

You can contact Salesforce support to request that a managed - released version be reverted to a managed - beta status if it is not installed in any orgs. If you want to rollback a specific version ...
ca_peterson's user avatar
  • 23.2k
4 votes
Accepted

AccountHistory not deleting immediately after an update

History records are not created until the end of the transaction. If you want to make sure those records are available for deletion, use a @future method, instead.
sfdcfox's user avatar
  • 502k
4 votes

Limitations when using ALL ROWS in query

Records once deleted reside in the recycle-bin, and they stay there for 15 days unless to forcefully delete them. Deleted records remain in the recycle bin for 15 days, and can be restored during ...
Mahmood's user avatar
  • 6,006
4 votes

Is there some event to delete record from Lightning component like e.force:deleteRecord

we can use force:recordData to delete the record in Lighting Component. To delete a record using Lightning Data Service, call deleteRecord on the force:recordData component, and pass in a callback ...
Gourishankar's user avatar
4 votes

UpsertData and DeleteData not working

I recently faced a very similar issue. It turned out that the UpsertData function was trying to create a row without providing a value of a required variable. To avoid this, one needs to make sure ...
Radek Janhuba's user avatar
4 votes

Revoke access to delete a specific Account record type

Kevin, You want to obtain the recordtype involved first, you can do it this way Id prospectRecordTypeId = Account.SObjectType.getDescribe().getRecordTypeInfosByDeveloperName().get('Prospect')....
Sebastian Kessel's user avatar
4 votes

Does contact deletion in marketing cloud also removes email tracking data?

There are two methods of deleting contacts: 1) Contact Deletion via Contact Builder This is a full hard delete and will NOT retain individual tracking data such as opens, clicks etc. However it ...
gpribudi's user avatar
  • 125
4 votes
Accepted

Override Standard Delete Action on Account Object

You cannot override the delete action. You need to remove the Delete permission for Account for those Profiles which you wish to disallow from this action. (This Trailhead project implements the ...
David Reed's user avatar
  • 93.7k

Only top scored, non community-wiki answers of a minimum length are eligible