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 - check approver in customproperty

janice
New Contributor
New Contributor

Hi Team,

We have two level approvals in the workflow where the approvers are getting from the prefix of requestee's customproperty, for example, the first 6 digits of the customproperty10 refers to the first approver and the first 6 digits of the customproperty11 refers to the second approver.

So, we would like to check in the workflow if the first approver and the second approver are the same person. If they are the same person, the workflow will skip the first level approval and route directly to the second level approval. 

Appreciate your help on this.

23 REPLIES 23

NM
Regular Contributor III
Regular Contributor III

Hi @janice , You can try something like below in workflow if else block and by selecting language as "Groovy"

(com.saviynt.ecm.identitywarehouse.domain.Users.executeQuery("select u.id from users u where SUBSTRING(u.customproperty10,1,7)=SUBSTRING(u.customproperty11,1,7) and u.id = 'userkey').size()==1)

janice
New Contributor
New Contributor

Hi @NM ,

Thank you very much for your help. I've tried a few queries as below but it returns error while submitting the request:

1) (com.saviynt.ecm.identitywarehouse.domain.Users.executeQuery("select u.id from users u where SUBSTRING(u.customproperty10,1,7)=SUBSTRING(u.customproperty11,1,7) and u.id='${user?.id}'").size()==1)

2) (com.saviynt.ecm.identitywarehouse.domain.Users.executeQuery("select u.id from users u where SUBSTRING(u.customproperty10,1,7)=SUBSTRING(u.customproperty11,1,7) and u.id='${user.id}'").size()==1)

3) (com.saviynt.ecm.identitywarehouse.domain.Users.executeQuery("select u.id from users u where SUBSTRING(u.customproperty10,1,7)=SUBSTRING(u.customproperty11,1,7) and u.id=${user.id}").size()==1)

NM
Regular Contributor III
Regular Contributor III

Hi @janice, have you selected language as "groovy" in if else condition?

and what error do you see in the logs?

janice
New Contributor
New Contributor

Hi @NM ,

Yes, I have selected the language as "groovy" and the log viewer shows nothing. 

NM
Regular Contributor III
Regular Contributor III

Hi @janice , Try hardcoding userkey in the workflow and see what result you get..and extract logs when you are trying to submit the request

NM
Regular Contributor III
Regular Contributor III

Hi @janice, Did it work we are also planning to use the samem

janice
New Contributor
New Contributor

Hi @NM , 

Tried hardcoding but still the same.

Our log viewer seems like having some issue now, hence unable to share the log at the moment. But will share the log once we got it. 

Share workflow screenshot


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

Hi @rushikeshvartak ,

Please find the attached screenshot. Thanks!

Use Updated Query, AND should be capital

(com.saviynt.ecm.identitywarehouse.domain.Users.executeQuery("select u.id from users u where SUBSTRING(u.customproperty10,1,7)=SUBSTRING(u.customproperty11,1,7) AND u.id = 'userkey').size()==1)


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

janice
New Contributor
New Contributor

Hi @NM ,

Please find the attached log.

NM
Regular Contributor III
Regular Contributor III

Hi @janice , As per the workflow screenshot missing a closing bracket at the end.

janice
New Contributor
New Contributor

Hi @NM @rushikeshvartak ,

I have updated the workflow but still the same. Here's the log and the screenshot of workflow

(com.saviynt.ecm.identitywarehouse.domain.Usergroup_users.executeQuery("select u.id from Users u where SUBSTRING(u.customproperty10,1,7)=SUBSTRING(u.customproperty11,1,7) AND u.id = 'userkey').size()==1)


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

Hi @rushikeshvartak 

Thanks for the query. This query is working for self-request, however when we perform "Request Access for Others", it routes to admin. Here's the workflow screenshot and log. 

NM
Regular Contributor III
Regular Contributor III

Hi @janice., The above query will just determine whether cp10 and 11 are same or not if not it will flow to else block.. so even if cp10 or cp11 value is empty it will go to admin..

Can you share approval block ss as well...

 

janice
New Contributor
New Contributor

Hi @NM ,

The id tested has value in both cp10 and cp11.

In the workflow, it is expected to route to different approver which is determined using custom query based on the substring of cp10 and cp11. Here's the screenshot of the workflow for your reference. It is working as expected for self request, however when "Request Access for Others", it routes to admin regardless the ifelse returns true or false. 

Please help me with below results to help further

 

RequestorEnd userRequestor Cp10Requestor Cp11End User Cp10End User Cp11Expected FlowCurrent Flow
rushirushi      
        
        
        
        
        
        

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

Hi @rushikeshvartak 

Please find my response below:

RequestorEnd userRequestor Cp10Requestor Cp11End User Cp10End User Cp11Expected FlowCurrent Flow
rushirushi12345678123456781234567812345678approver1approver1
rushirushi12345678111122221234567811112222approver2approver2
rushijanice12345678123456781234567812345678approver1admin
rushijanice12345678123456781234567811112222approver2admin

The third and fourth rows are the scenario where rushi submit request access for janice. Hence, the query should check janice's cp10 and cp11 to determine the approver. 

 

janice
New Contributor
New Contributor

Hi @rushikeshvartak ,

May I know if you have any advise on this? Thanks in advanced. 

This is expected behaviour when requestor = Approver request will be assigned to admin


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

Hi @rushikeshvartak 

Thanks for your response. 

The approvers are another ID we created, hence the requestor is not equal to approver in the case when it routes to admin. 

Please share current workflow screenshot


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