A common task for document management system is to move a document from one library to another when the document approval status meets some condition. Unfortunately, there is no Move core action provided from the out of box functionality. There is however other core actions that we can leverage to implement this solution.
Move Documents |
Workflow Core Actions
When building our workflows, we can use a couple of actions that enable us to move a document from one document library to another.
Core Action | Description | ||||||
Copy | Use this action to copy the document across document libraries
| ||||||
Delete | Use this action to delete the document from a document library
|
Implementing a Move workflow
After adding a workflow using SharePoint Designer, we can add a couple of actions to the first step.
For the copy item action, we want to select the current item which is a reference to the document that triggers the workflow. We also select the document library where we want to copy the document. This action makes a copy of the document, so this means that the document is located in two different document libraries which may not be the intended behavior.
After the document is copied, we can delete the document from the current location using the Delete action and passing the current item as an argument. This should remove the other copy from the source document library.
In our example, we copy the current item to a Drop Off document library. Since we do not want a copy of the document on the source library, we then delete the current item.
Note: Current item is the scope object reference to the document that triggers the workflow.
Summary
We have shown that a move action can be implemented using the Copy and Delete core actions. For some use cases, this may not be a correct implementation since this creates a copy of the document and a different document id which uniquely identifies a document in the system.
When this behavior does not meet our requirements, there is another core action that we can use to actually move the document. This approach however comes at a cost of more configuration complexity as well as the need to enable other site features. We can read more about this on my next blog entry:
I hope this is able to provide you with a simple approach to move a document from one document library to another.
0 comments :
Post a Comment
What do you think?