Announcing the Saviynt Knowledge Exchange unifying the Saviynt forums, documentation, training,
and more in a single search tool across platforms. Read the announcement here.

Workflow if-else check if entitlement owner contain manager

fuko
New Contributor III
New Contributor III

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.

  • My first attempt is "entitlement.getOwnerRank1().contains(user.manager) eq true" but it complain syntax error started at "eq true"
  • My second attempt is "entitlement.getOwnerRank1().contains(user.manager) == true"
  • My last attempt is "entitlement.getOwnerRank1().contains(manager.systemUserName)" because when I tried to put more statements to debug (of course, it returns error), I saw this is how it's evaluated in the log:
(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:

  • what are inside "entitlement.getOwnerRank1()"
  • is my statement correct: ""entitlement.getOwnerRank1().contains(manager.systemUserName)" to check the condition of manager is part of the entitlement owner?
  • how to debug any if-else condition?

Thank you

fuko_0-1710643961106.png

 

6 REPLIES 6

CR
Regular Contributor III
Regular Contributor III

entitlement.getOwnerRank1() : what are is der in enti->owner tab details we can compare this binding variable

ref:

CR_0-1710695461949.png

try like below

entitlement.getOwnerRank1().contains(user.username) eq true

or

entitlement.getOwnerRank1().contains(manager.username) eq true

Workflow components:

https://docs.saviyntcloud.com/bundle/EIC-Admin-v23x/page/Content/Chapter12-Workflows/Workflow-Compon...

 

 

 

 


Thanks,
Raghu
If this reply answered your question, Please Accept As Solution and hit Kudos.

PremMahadikar
Regular Contributor III
Regular Contributor III

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.

rushikeshvartak
All-Star
All-Star

Make sure your workflow type in parallel 


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

fuko
New Contributor III
New Contributor III

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.

 

fuko
New Contributor III
New Contributor III

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)

 

CR
Regular Contributor III
Regular Contributor III

Great to hear.

 


Thanks,
Raghu
If this reply answered your question, Please Accept As Solution and hit Kudos.