The document is stuck in Pre-release status with batch job error.

Background: 

The document is stuck in Pre-release status with a batch job error as shown below. 

Database.Error[getFields=();getMessage=compliancequest.SQX_Controlled_Document_Trigger: execution of BeforeUpdate

caused by: System.DmlException: Delete failed. First exception on row 0 with id 069###############; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, This content cannot be deleted since it is part of audit trailed record(s): ##################: []

(compliancequest);getStatusCode=CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY;]

This issue occurs in CQ v9.2.4 and is resolved is CQ v9.2.5. The issue will occur for the documents that were created before applying v9.2.5 or higher version.

Solution:

The only option is to delete the content link by following the below steps by the system administrator. 

  1. Go to developer console.


  1. Paste the below query in Query Editor.
     These Ids are available in the batch job error itself. Content ID will be in 069############### and other id is a controlled document Id.

SELECT compliancequest__LinkedEntityId__c, Id, compliancequest__ContentDocumentId__c FROM compliancequest__CQ_Content_Link__c where compliancequest__LinkedEntityId__c ='Id of the document' AND compliancequest__ContentDocumentId__c = 'Id of the content'

  1. Click on Execute.

 

  1. Select the rows and click on Delete rows. Confirm the change.

A screenshot of a computerDescription automatically generated

28 Dec 2022, 08:23 PM

  1. Go back to document detail page. Remove the batch job error and update Batch Job Status to Pre-Release Queued/Release Queued.
  2. Click Save.
  3. Wait for 2 mins and reload the page, if there is batch job error with new id then repeat the process from 1 to