I have a folder that has no template fields, using workflow I want to move the folder using the template field values of documents contained in the respective folder to another location. How do I get the template field values from the document?
Question
Question
Move folder to new location based on document template fields
Answer
Hi Richard! You can use Find Entry to get the document that resides in the folder that you are working with. Something like this:
Then you can use Retrieve Field Values to get the field you want from that document (here I'm getting some field called "Student ID"); be sure to select Other Entry for the source, and point to the entry you found with Find Entry:
Finally you'd use the token you got from Retrieve Field Values to move your folder to some location:
This sample assumes that you know the exact document that you want the fields from (in my example, it's called "TheDocument"). You can also use a Search Repository activity in order to construct a more advanced search query that can be used to pick up a specific document based on some search. Or you could also use Find Entries to get all the entries inside the folder and go through them one by one to find the template field you need. You can also use tokens inside Find Entry to help find the document you need. There are tons of ways to get this done!
Replies
Thank you for the suggestions. Unfortnately I do not know the document names in the folder, I have tried what you suggested using a wild card, find entries, nothing seems to return an entry with the template fields.
Try using a Find Entries activity and point it towards your folder by specifying the "at" property of Find Entries, and make sure to select Documents from Filter Entries. Then, add a For Each Entry activity and point it towards the Find Entries activity. Now do something similar to what I suggested above, but instead of referencing the Find Entry activity using Retrieve Field Values, point it to the "Current Entry" of the For Each Entry, as pictured here:
Then add a Conditional Sequence to specify that you should only move the entry if you actually found the field with your Retrieve Field Values. You can do that this way:
It may also be more efficient to use a Search Repository with a more specific query here. For example, you can replace Find Entries with a Search Repository that only gets entries that have that field (though you'll still need the For Each Entry):
I tried to do the find entries and point it to the folder but it still does not return any entries, so it does not get any field values for me to move it to the appropriate folder. The error log shows no entry found. Here is my workflow it must be something with finding the documents in that folder
Do you really have a folder called "*" under "Expense Reports?
No, I was just trying to get any document in that folder since I do not know the name of the documents.
Then the path should be just \Expense Reports. The activity has a separate option to specify what type of entries you want back. There's no filtering, all entries of the specified type will be returned.
Richard, try this:
Note that the description under the Find Entries in your screenshot says "Find Entries in the folder:". Currently Find Entries doesn't support wildcard characters... though the Search Repositories activity exists for that.
Yea, as a last resort I tried the wild card as I had it with just \Expense Reports and it did not work.
You would think it would be simple, grab a document from within the folder and get the field values. Still will not work.
Richard, these documents are directly in the Expense Reports folder, right? Find Entries does not go through subfolders currently.
There is likely something else wrong with the setup, as it shouldn't be more complicated than this. Things to check:
1) Name of the folder matches exactly (check to make sure spaces match exactly; use the browse button to select your folder, just to be safe)
2) Make sure Documents is selected under "Filter Entries"
3) Make sure the Workflow's connection profile is pointing to the right repository.
4) I know it sounds silly, but make sure there are entries in the folder before you call Find Entries (in case, for example, the entries are created or moved into the folder by a workflow).
5) In Laserfiche, check that the Connection Profile's user actually has access rights to those documents. (right click the entry, select Access Rights, and check the Effective Rights for the user that you specified for your connection profile in Workflow).
6) As Miruna suggested above, if your documents are in subfolders, you should use the Search Repositories activity instead of the Find Entries activity. Creating a custom search is quite simple actually, and it gives you added flexibility: Go to the Laserfiche Client and perform a search that returns the files that you expect Workflow to find. Then, under Customize Search, select "Advanced". You will see a textbox with the "advanced search syntax", which you can use directly in the Search Repositories activity.
The advantage of using this method is that you can make your search more complex and specific, such as making sure that that the entries contain the field, or the template, etc.
There are no sub folders, the documents are directly under the folder.
The workflow does move the folder to the new location but the fields that it is to retrieve from the documents are not being retrieved, so it is placed in a folder without using the field values to place it in specific documents. As an example the template field expense describes the expense, such as meals, it is supposed to move the folder to the location, \Archive Expense reports\Employee Name\Meals
It gets the entry which is the employee name but does not create the sub folder meals, just places the folder under the employee name.
Started the Workflow from scratch, reworked the entry from ground 0 and it worked, I believe the path was expense reports\entry name
Thank you all so much for your help.