Set document approval status within approval workflow
-
Sunday, January 13, 2013 1:03 PM
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=NoI 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=YesThe 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()
- Edited by orange juice jones Sunday, January 13, 2013 2:00 PM
All Replies
-
Monday, January 14, 2013 10:55 AMModerator
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
Entan Ming
TechNet Community Support -
Monday, January 14, 2013 12:17 PM
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
-
Tuesday, January 15, 2013 1:34 AMModerator
-
Tuesday, January 15, 2013 10:11 AM
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
-
Wednesday, January 16, 2013 1:53 AMModerator
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
Entan Ming
TechNet Community Support- Marked As Answer by Entan MingMicrosoft Contingent Staff, Moderator Thursday, January 24, 2013 6:23 AM
-
Wednesday, January 16, 2013 3:33 AM
try this link... it wil surely help you..
http://sharepointresourcecenter.com/sharepoint-2010-workflows-and-document-sets.html


