and more in a single search tool across platforms. Read the announcement here. |
03/16/2024 08:01 PM
Hi there,
In our project, we have a requirement that if the reporting officer (aka user's manager) is the same as dashboard owner (which is entitlement owner), then skip the dashboard owner approval. It is implemented as the If-else block as in the below image where the condition is: "entitlement.getOwnerRank1().contains(manager.systemUserName)"
The problem is I never get it work. It seems to always evaluate to the else clause.
(System.out.println "Entitlement owner: " entitlementslist.get(requestaccesskey).getOwnerRank1(); System.out.println "Manger system username: " manager.systemUserName; entitlementslist.get(requestaccesskey).getOwnerRank1().contains(user.manager) == true) == true
So my questions are:
Thank you
Solved! Go to Solution.
03/17/2024 10:17 AM
entitlement.getOwnerRank1() : what are is der in enti->owner tab details we can compare this binding variable
ref:
try like below
entitlement.getOwnerRank1().contains(user.username) eq true
or
entitlement.getOwnerRank1().contains(manager.username) eq true
Workflow components:
03/17/2024 12:39 PM
Hi @fuko ,
This is working for me: entitlement.getOwnerRank1().contains(manager.username) eq true
If this reply answers your question, please consider selecting Accept As Solution and hit kudos.
03/17/2024 05:55 PM
Make sure your workflow type in parallel
03/17/2024 07:56 PM
Hi @CR, Thanks for the reference, I have gone through it before raising this question. What I actually want to ask for the question "what are inside "entitlement.getOwnerRank1()"" is whether the result is a list of userkey or a list of username or a list of user object. If it's a list of userkey and I check whether it contains a username would always lead to else clause. But it seems like all of the others responders have the same thinking as it will be the list of username.
Hi @PremMahadikar , it seems doesn't work on me 😯 Again it's still the syntax error (see the attached log)
"2024-03-18T02:43:11.061+00:00","ecm","","null-kwdgr","","Caused by: javax.script.ScriptException: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:"
"2024-03-18T02:43:11.061+00:00","ecm","","null-kwdgr","","Script1.groovy: 1: expecting ')', found 'eq' @ line 1, column 84."
"2024-03-18T02:43:11.061+00:00","ecm","","null-kwdgr",""," ().contains(manager.username) eq true) ="
"2024-03-18T02:43:11.061+00:00","ecm","","null-kwdgr",""," ^"
"2024-03-18T02:43:11.061+00:00","ecm","","null-kwdgr","",""
"2024-03-18T02:43:11.061+00:00","ecm","","null-kwdgr","","1 error"
"2024-03-18T02:43:11.061+00:00","ecm","","null-kwdgr","",""
"2024-03-18T02:43:11.061+00:00","ecm","","null-kwdgr",""," at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:152)"
"2024-03-18T02:43:11.061+00:00","ecm","","null-kwdgr",""," at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264)"
"2024-03-18T02:43:11.061+00:00","ecm","","null-kwdgr",""," at org.jbpm.pvm.internal.script.ScriptManager.evaluate(ScriptManager.java:123)"
"2024-03-18T02:43:11.061+00:00","ecm","","null-kwdgr",""," ... 39 more"
"2024-03-18T02:43:11.061+00:00","ecm","","null-kwdgr","","Caused by: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:"
"2024-03-18T02:43:11.061+00:00","ecm","","null-kwdgr","","Script1.groovy: 1: expecting ')', found 'eq' @ line 1, column 84."
"2024-03-18T02:43:11.061+00:00","ecm","","null-kwdgr",""," ().contains(manager.username) eq true) ="
Hi @rushikeshvartak, yep, my workflow type is parallel. I saw on other post that if it's serial then the entitlment object is null, which leads to another error which is not this case. It's also noted in red in the help of workflow designer.
03/17/2024 08:31 PM
Hi @CR and @PremMahadikar
This is the one that works for my case (seems that the boolean evaluation part need to be dropped)
entitlement.getOwnerRank1().contains(manager.username)
03/17/2024 10:06 PM
Great to hear.