Workflow task button filter - custom EL expression

I want to activate a task button depending on a property in the input document: In the filter-input in the workflow node properties Task Button tab I've put the following ID: PanMuntligOverlaggning_enable

Then in Advanced Settings->Xml Extensions I have an extions doing this:

<extension target="org.nuxeo.ecm.platform.actions.ActionService"
  point="filters">
  <filter id="PanMuntligOverlaggning_enable">
    <rule grant="true">
      <condition>#{currentDocument.getPropertyValue('pananmodan:yrkande') == '1'}</condition>
    </rule>
</extension>

The input document has the property “pananmodan:yrkande”: “1” defined as String

EDIT: I've realized that the “currentDocument” might be the workflow document and not the input document, still no success. Is it possible to access workflow variables in the filter?

The button is not visible, any suggestions? I want the button to be visible only in the case of that said attribute beeing the string value 1 Thanks in advance

0 votes

3 answers

1431 views

ANSWER



Clarification, i'm using WebUI not JSFUI. I suspect that the solution I try to do doesnt work in WebUI. Although the help text in the workflow editwindow implies that a filterId should be specified, and the only way I found to use filters is with above mentioned ActionService xml extension.

0 votes



Thank you for the answer I think I miss something fundamental in this case, nothing seems to be accessible,

<extension target="org.nuxeo.ecm.platform.actions.ActionService"
  point="filters">
  <filter id="PanMuntligOverlaggning_enable">
    <rule grant="true">
      <condition>#{currentDocument!= null}</condition>
    </rule>
  </filter>
</extension>

Doesn't work, seems I have no access to most things I tried, only thing that gives a true on the null check is “currentUser”

<extension target="org.nuxeo.ecm.platform.actions.ActionService"
point="filters">
<filter id="PanMuntligOverlaggning_enable">
<rule grant="true">
<condition>#{true}</condition>
</rule>
</filter>
</extension>

Works ofc, so the filter is active and “working” I just dont seem to have any variables to access in this context. So I guess the first realization here is to figure out what my actual context is so I can figure out what objects I have access to The button I want to hide is in a task sent from a workflow

I'm using Nuxeo Platform 2019 (server 10.10) , with Nuxeo JSF UI 10.10.0 installed

0 votes



So yes, the filter should be pointing to the workflow instance itself, so you should use its variable. In your case, you would have to copy the value of pananmodan:yrkande into a workflow variable myWorkflowVariable and have the filter like

<condition>#{currentDocument.myWorkflowVariable == '1'}</condition>

Let's try it

0 votes



I tried it and did not seem to have access to any or few data. I've tried things like "currentDocument != null" that seems to give false. I've updated with additional info in the answers. Clarification is that its WebUI that I use
08/17/2020