You are viewing limited content. For full access, please sign in.

Question

Question

Search metadata on folders only

asked on September 12, 2022

I have a scenario where I want to search the metadata on folders only and in the results see only folders, not entries. For some reason, it works in our Test reposiotory, but not our Production repository. Both repos are hosted on the same server, so I know it's not a version issue. We're up-to-date on the latest release of Laserfiche 11. Search syntax looks like this:

 

{[Journal Entry]:[Post Date]>="2022-08-01", <="2022-08-31"} & {LF:Name="*", Type="F"} & {LF:LOOKIN="Rio-Test\Finance\Journal Entries\Non Posted", SUBFOLDERS=0}

 

The metatdata template name is "Journal Entry". There a date field called "Post Date", and we want to find all folders for journal entries that should be posted in August. Inside the "\Finance\Jounal Entries\Non Posted" folder will be a collection of folders that have various entries inside them, and the folders themselves will have the Journal Entry template assigned and a date in the Post Date field.

 

This search is actually done in a Workflow, and it didn't work when we moved from Test to Prod. I tried it out in the Laserfiche desktop client and see the same behavior: works in Test, not in Prod. I'm re-indexing the production repository now to see if that fixes it but I don't have high hopes. Does anyone know of anything else that can be set at the repository level that would make this behavior different between two repos on the same server?

0 0

Answer

SELECTED ANSWER
replied on September 14, 2022

Well I found it with a support call and a second set of eyes. His first thought was security as well but that wasn't the issue. It was actually two unrelated things that made it appear to be the same issue.

 

In the first scenario, in my original post, we were searching a date range in the Post Date field of the Journal Entry template. The issue was that when we copied the Process from our Test Forms environment to the Production Forms environment, the "Save To Repository" task stripped the Template value out of the Parent Folder fields, so the metadata fields were being populated, but without a template selected. Since the search syntax is specifically looking for the Post Date field in items with Journal Entry selected as the metadata template, and no template was assigned, the results were empty. The fix was in the Process in Forms; nothing wrong with the search syntax.

 

The second scenario was a workflow that adds metadata (template and fields) to new employee records after they are hired. A new employee has a number of documents to upload via forms, and when reviewed and approved by HR, they are placed into a folder named after their name and employee number. It would then trigger a workflow that would search for that folder and add the "Employee Records" template to it and apply the correct metadata. The Search Syntax in that workflow also contained "{LF:Name="*", Type="F"}" to limit the results to folders, which is what made me think that was the broken part. Turns out the problem was that the employee had an apostrophe (or single quote ' ) in their name, and the workflow wasn't designed to escape single quotes when parsing tokens. So the %(LastName) token would go into the search as "O'Malley" (for example) which borked the search. Needed to be "O''Malley" (double the single quote to escape it and use it as a literal single quote instead of a string encapsulator). Just a huge coincidence that we hired someone with an apostrophe in their name at the same time as the new Journal Entry process was being used for the first time since we deployed it. I fixed the workflow by replacing the "Search Repository" activity with the more efficient "Find Entry" activity, since we know the exact path to the folder we want to operate on anyway. (I built the workflow a few years ago when I wasn't as familiar with all the activities available to workflow)

Thank you to Dustin and Miruna for taking the time to read and respond to my posts. It's great to be part of such an active community!

3 0

Replies

replied on September 13, 2022

I suggest building the syntax in the Windows Client with the GUI option to get it where you want it for PROD, then pasting into Workflow. The prior comment may be correct, if you just used the same syntax from TEST, the repository path could be incorrect, or there could be a slight difference in spelling, spacing, etc.

1 0
replied on September 13, 2022

The syntax was built in the web client originally, then moved into workflow. I also built the search in the desktop client and it comes out identical.

0 0
replied on September 13, 2022

Ok, so let's assume the syntax is good. Define "doesn't work"...

Are you getting an error?

Is it simply not returning the expected results?

1 0
replied on September 13, 2022

No results are returned, but also no error message.

I have another workflow that relies on search that has been working for quite some time and has suddenly stopped working, and it too has "{LF:Name="*", Type="F"}" in the search syntax. Very odd. I may have to open a support case on this one.

0 0
replied on September 14, 2022

Have you checked for security changes for the user specified in the connection profile in your workflow? Maybe the user can't see those entries anymore. Try logging in as that user in the Windows or web client and running the same search.

2 0
replied on September 14, 2022

That is my thought as well. This sounds like an Access Rights issue for your "Workflow" user (the user account used in the Connection Profile for this PROD Workflow).

I bet you'll find, when you login with that account via Windows Client or Web Client, as suggested by Miruna, that you won't be able to see the full repository (that user will have limited access).

1 0
SELECTED ANSWER
replied on September 14, 2022

Well I found it with a support call and a second set of eyes. His first thought was security as well but that wasn't the issue. It was actually two unrelated things that made it appear to be the same issue.

 

In the first scenario, in my original post, we were searching a date range in the Post Date field of the Journal Entry template. The issue was that when we copied the Process from our Test Forms environment to the Production Forms environment, the "Save To Repository" task stripped the Template value out of the Parent Folder fields, so the metadata fields were being populated, but without a template selected. Since the search syntax is specifically looking for the Post Date field in items with Journal Entry selected as the metadata template, and no template was assigned, the results were empty. The fix was in the Process in Forms; nothing wrong with the search syntax.

 

The second scenario was a workflow that adds metadata (template and fields) to new employee records after they are hired. A new employee has a number of documents to upload via forms, and when reviewed and approved by HR, they are placed into a folder named after their name and employee number. It would then trigger a workflow that would search for that folder and add the "Employee Records" template to it and apply the correct metadata. The Search Syntax in that workflow also contained "{LF:Name="*", Type="F"}" to limit the results to folders, which is what made me think that was the broken part. Turns out the problem was that the employee had an apostrophe (or single quote ' ) in their name, and the workflow wasn't designed to escape single quotes when parsing tokens. So the %(LastName) token would go into the search as "O'Malley" (for example) which borked the search. Needed to be "O''Malley" (double the single quote to escape it and use it as a literal single quote instead of a string encapsulator). Just a huge coincidence that we hired someone with an apostrophe in their name at the same time as the new Journal Entry process was being used for the first time since we deployed it. I fixed the workflow by replacing the "Search Repository" activity with the more efficient "Find Entry" activity, since we know the exact path to the folder we want to operate on anyway. (I built the workflow a few years ago when I wasn't as familiar with all the activities available to workflow)

Thank you to Dustin and Miruna for taking the time to read and respond to my posts. It's great to be part of such an active community!

3 0
replied on September 13, 2022

I presume this is not the production version search syntax... the lookin leads with "Rio-Test".

0 0
replied on September 13, 2022

Yes, the lookin leads with Rio-Test because I pasted the one I was using in test. The one for production is identical except the repo name does not have "-Test" at the end of it. Paths in both repos are identical.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.