05-03-2012 02:27 AM
Hi,
I have created an user action button that needs to be displayed only for a document when under a certain folder and when the document is in "approved" state.
I cannot use the STARTSWITH within the query because while the folder name is defined e.g. say all folders named "test", the path is not. The users have the right to modify the names of the folders within the path. Hence the query has to check for, at least, if the path has the word "Proposal" in it.
My condition goes like this
<rule grant="false">
<condition>document.currentLifeCycleState != "approved"</condition>
<condition>path NOT ILIKE '%test%"</condition>
</rule>
However I am not getting the required result and the action button shows no matter what folder the document is in. The "approved" condition however works correctly.
I have tried the above conditions with options "OR" in a single line but even that does not give the desired results.
What am I doing wrong? Any solutions?
thanks in advance.
05-03-2012 06:55 AM
The NXQL in a condition of a filter is not permit.
When you want to make complex condition in your filter you should better use an EL expression to call a method from a Bean.
For example, in your xml contribution :
<rule grant="false">
<condition>#{myDocumentActions.isPathContainsWord('Proposal')}</condition>
</rule>
With the method isPathContainsWord() looks like :
public boolean isPathContainsWord(String word) {
DocumentModel currentDoc = navigationContext.getCurrentDocument();
return currentDoc.getPathAsString().contains(word);
}
For more informations you can read the User Actions Documentation.
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.