In my salesforce.com org, Process Instance Node still occupy data storage after removing related objects and approval process. I have try several tools to delete unsuccessfully. Therefore, I keep a note and will update this post continuously until they are gone.
Data Loader Only for Standard and Customize Object
Salesforce Data Loader is used on bulk database operation (insert, update, upsert, delete, hard delete, export, and export all).
It could be download from Salesforce: Data Loader [Administration Setup] → [Data Management] → [Data Loader] and supports Windows and Mac.
Before login, I need to use [Personal Setup] → [My Personal Information] → [Reset My Security Token] to get my security token in an email with subject Your new Salesforce security token. Append it at the end of password while login.
Workbench See Full Objects
Salesforce Workbench is a web tool. Unlike Data Loader, it could be login with administration account without security token. Therefore, I may use Workbench Tools for Google Chrome and Workbench Tools for Firefox to transfer Salesforce session to Workbench.
Get Detail of ProcessInstanceNode Object
After login, I select Standard & Custom Objects in Jump to and ProcessInstanceNode in Object to see description. There is a deletable:false in Attributes folder. It means I don’t have delete permission.
For more objects, use menu [Info] → [Standard & Custom Objects].
Verify by Running SOQL Query
To verify this is the object which contains useless records, select [queries] → [SOQL Query] to generate following query and View as List. Click [Query] button to execute.
SELECT CreatedDate,Id,IsDeleted,NodeStatus,ProcessNodeName FROM ProcessInstanceNode ORDER BY CreatedDate ASC NULLS FIRST
From query results, I am sure they are undeleted approval history because IsDeleted are false. Strangely, the returned record count is much more than [Administration Setup] → [Data Management] → [Storage Usage] reports.
Delete a Record but Fail
When I move my mouse on Id field of a record, Update, Delete, Undelete, Purge, and View in Salesforce are available actions.
Update doesn’t provide IsDeleted to edit; Delete returns result Insufficient Access Rights On Object Id; View in Salesforce shows Insufficient Privileges. I follow the lead to read Insufficient Privileges Errors and check Object Settings and System Permissions on my profile but there is no related items.
Privilege is the Key
Although I found the right tool, there is still privilege issue. Still searching a solution to remove ProcessInstanceNode records.
Generate a Report on ProcessInstanceNode
Create a Custom Report Type for Approval History reminds me to create a custom report type before reporting on ProcessInstanceNode.
Use [App Setup] → [Create] → [Report Types] to create a new record type on Process Instance as primary object. Select Process Instance Node in related object in step 2. How to clear ProcessInstanceNode records? on StackExchange Salesforce has an illustration on Process Data Model which explains Entity–relationship model of them.
Because I found no Process Instance record using Workbench, my reports shows nothing at all. It means my ProcessInstanceNode are not cascade deleted when deleting Process Instance.
Reference
- Chrome Web Store: Workbench Tools for Google Chrome
- Mozilla Add-ons: Workbench Tools for Firefox
- Salesforce: Data Loader
- Salesforce: Developer Documentation: ProcessInstance
- Salesforce: Developer Documentation: ProcessInstanceNode
- Salesforce: Documentation: Create a Custom Report Type for Approval History
- Salesforce: Documentation: Insufficient Privileges Errors
- Salesforce: Workbench
- StackExchange: Salesforce: How to clear ProcessInstanceNode records?
- Wiki: Entity–relationship model
- Wiki: Foreign key