Study on Removing Unwanted Process Instance Node in Salesforce.com


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

  1. Chrome Web Store: Workbench Tools for Google Chrome
  2. Mozilla Add-ons: Workbench Tools for Firefox
  3. Salesforce: Data Loader
  4. Salesforce: Developer Documentation: ProcessInstance
  5. Salesforce: Developer Documentation: ProcessInstanceNode
  6. Salesforce: Documentation: Create a Custom Report Type for Approval History
  7. Salesforce: Documentation: Insufficient Privileges Errors
  8. Salesforce: Workbench
  9. StackExchange: Salesforce: How to clear ProcessInstanceNode records?
  10. Wiki: Entity–relationship model
  11. Wiki: Foreign key
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s