Set document approval status within approval workflow

Hi

I have a Document Library with the following Settings: -

Require content approval for submitted items=  Yes
Require documents to be checked out before they can be edited=No

I have a SPD approval workflow acting on a document library.  Everything works but I am now required that the user is forced to check-out the document.

I now set the document library to :

Require content approval for submitted items=  Yes
Require documents to be checked out before they can be edited=Yes

The workflow fails due to requiring the document to be checked-out. So I add the following actions within the workflow

'Checkout item in current item' and 'Set Content Approval status to Approved' Actions in the workflow

Now workflow checks out document, but a different error occurs. workflow history shows :User Id System Account, Event type - Error

The workflow could not update the item, possibly because one or more columns for the item require a different type of information.

I've looked for soltions but cant find any answers. Any help appreciated, using 2010 with latest CU.

I've added actions to 'When a Task Completes'


System.Workflow.Runtime.Hosting.PersistenceException: You cannot perform this action on a checked out document. ---> Microsoft.SharePoint.SPException: You cannot perform this action on a checked out document.    
 at Microsoft.SharePoint.SPListItem.SetRequiredInfoForUpdateItem(Boolean bDocLib, Boolean bAdd, Boolean bMigrate)    
 at Microsoft.SharePoint.SPListItem.PrepareItemForUpdate(SPWeb web, Boolean bMigration, Boolean& bAdd, Boolean& bPublish, Object& objAttachmentNames, Object& objAttachmentContents, Int32& parentFolderId)    
 at Microsoft.SharePoint.SPListItem.UpdateInternal(Boolean bSystem, Boolean bPreserveItemVersion, Guid newGuidOnAdd, Boolean bMigration, Boolean bPublish, Boolean bNoVersion, Boolean bCheckOut, Boolean bCheckin, Boolean suppressAfterEvents, String filename, Boolean bPreserveItemUIVersion)    
 at Microsoft.SharePoint.SPListItem.Update()    
 at Microsoft.SharePoint.Workflow.SPWinOEWSSService.CommitUpdateDocument(Transaction txn, Object[] transData)    
 at Microsoft.SharePoint.Workflow.SPPendingWorkBatch.Commit(Transaction transaction, ICollection items)    
 at System.Workflow.Runtime.WorkBatch.PendingWorkCollection.Commit(Transaction transaction)    
 at System.Workflow.Runtime.WorkBatch.Commit(Transaction transaction)    
 at System.Workflow.Runtime.Hosting.WorkflowCommitWorkBatchService.CommitWorkBatch(CommitWorkBatchCallback commitWorkBatchCallback)    
 at System.Workflow.Runtime.Hosting.DefaultWorkflowCommitWorkBatchService.CommitWorkBatch(CommitWorkBatchCallback commitWorkBatchCallback)    
 at System.Workflow.Runtime.WorkflowExecutor.CommitTransaction(Activity activityContext)    
 at System.Workflow.Runtime.WorkflowExecutor.Persist(Activity dynamicActivity, Boolean unlock, Boolean needsCompensation)     -
 -- End of inner exception stack trace ---    
 at System.Workflow.Runtime.WorkflowExecutor.Persist(Activity dynamicActivity, Boolean unlock, Boolean needsCompensation)    
 at System.Workflow.Runtime.WorkflowExecutor.System.Workflow.ComponentModel.IWorkflowCoreRuntime.PersistInstanceState(Activity activity)    
 at System.Workflow.ComponentModel.Activity.MarkClosed()    
 at System.Workflow.ComponentModel.Activity.ReleaseLockOnStatusChange(IActivityEventListener`1 eventListener)    
 at System.Workflow.ComponentModel.FaultAndCancellationHandlingFilter.SafeReleaseLockOnStatusChange(ActivityExecutionContext context)    
 at System.Workflow.ComponentModel.FaultAndCancellationHandlingFilter.OnEvent(Object sender, ActivityExecutionStatusChangedEventArgs e)    
 at System.Workflow.ComponentModel.ActivityExecutorDelegateInfo`1.ActivityExecutorDelegateOperation.Run(IWorkflowCoreRuntime workflowCoreRuntime)    
 at System.Workflow.Runtime.Scheduler.Run()

January 13th, 2013 1:03pm

Hi,

I understand that you want to approve a document in a SharePoint designer workflow. Since you set the Require documents to be checked out before they can be edited=Yes, you will need to check out the document when run the workflow on the item. But you cannot approve a document when it is checked out. So the logic in workflow conflicts. Here is a workaround, you can use the Approval Workflow created in browser to achieve this. It will allow you to approve the document without checking it out.

Thanks,

Entan Ming

Free Windows Admin Tool Kit Click here and download it now
January 14th, 2013 10:55am

Hi

Thanks for the workaround, but within the SPD workflow I have other custom actions going on also. Is there another way to achieve my requirements.

Unfortunately, it looks like I cannot enable 'Require Checkout' in the library, which is a step back for me  and users.

Thanks

January 14th, 2013 12:17pm

Hi,

I think you can set Require document to be checked out before they can be edited to No, then you can use SharePoint designer workflow to edit the Approval Status.

Thanks,

Entan Ming

Free Windows Admin Tool Kit Click here and download it now
January 15th, 2013 1:34am

Hi

Are you suggesting I should 'set Require document to be checked out before they can be edited to No' within the workflow ? Wont this affect the entire library, any documents within then will be also affected ?

Thanks

January 15th, 2013 10:11am

Hi,

What I suggest is set the 'Set Require document to be checked out before they can be edited to No' for the entire library. Then the workflow can edit the approval status for the documents.

If you only want to start an approval process for a document and change the approval status after the approval status completes, you can create an approval workflow in browser instead. When using the workflow created in browser, you can check 'Enable content approval'. In this way the workflow will Update the approval status after the workflow is completed. And the workflow can update the approval status without check out the document, which means you can leave the 'Require document to be checked out before they can be edited' to Yes.

Thanks,

Entan Ming

Free Windows Admin Tool Kit Click here and download it now
January 16th, 2013 1:53am

try this link... it wil surely help you..

http://sharepointresourcecenter.com/sharepoint-2010-workflows-and-document-sets.html

January 16th, 2013 3:33am

Entan,  I apologize in advance, I am new to SharePoint. 

How does one create an "Approval Workflow in a browser"? 

I am running SP 2013 Enterprise in a Office365 environment.

Thank you.

Free Windows Admin Tool Kit Click here and download it now
June 20th, 2013 3:14pm

This response, even though it is almost 2 years old, is entirely unacceptable. This problem still exists in SharePoint Foundation 2013. As far as I know, it has never worked.
March 11th, 2015 9:18pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics