We are delighted to share our new EIC Delivery Methodology for efficiently managing Saviynt Implementations and delivering quick time to value. CLICK HERE.

Can we auto reject workflow based on customquery

rituparna_pwc
Regular Contributor
Regular Contributor

We have a requirement where a workflow should get assigned to usergroup for approval. We have done this.

Is it possible to achieve if requestor is part of user group then reject request else assign to the usergroup?

In if-else block of workflow, usergroup is not exposed

14 REPLIES 14

shivmano
Regular Contributor III
Regular Contributor III

@rituparna_pwc Using custom assignment task, you may be able to auto approve but auto reject may not be possible as it will always need an assignee when you use the custom query. 

You can perhaps try assigning the request to 'admin' user when requestor is part of user group and then use the escalation block to then auto reject. Please check and confirm if this option works or not 

@shivmano , how can we use custom assignment task to auto approve? Can you please help.

shivmano
Regular Contributor III
Regular Contributor III

Can you try below queries 

select coalesce((select case when u.userkey = ${user.id} then ${requestedby.id} when u.userkey =${requestedby.id} then ${requestedby.id} else u.userkey end as userkey from users u where u.userkey in (select userkey from usergroup_users where user_groupkey = <user_groupkey>)),(select manager as userkey from users where userkey = ${user.id} ))as userkey

 

SELECT u.userkey
FROM
users u
WHERE
CASE WHEN
EXISTS (select userkey from usergroup_users where user_groupkey = <user_groupkey> and userkey = ${user.id})
THEN u.userkey = ${requestedby.id}
ELSE
u.userkey IN (select userkey from usergroup_users where user_groupkey = <user_groupkey>)
END

@shivmano , I am assigning the request to admin if requestor is part of user group but how do we auto reject that? If I put escalation wont all request get escalated?

shivmano
Regular Contributor III
Regular Contributor III

Yes, if you are going to add both the true and false statements in the same custom assignment query, then even the ones assigned to user group will be escalated. Hence, you may have to try keeping your custom query with only the rejection statement where user is part of user group 

shivmano
Regular Contributor III
Regular Contributor III

Can you try adding the below statement in the if-else block and see if that helps? Make sure to keep the Language as Groovy

(com.saviynt.ecm.identitywarehouse.domain.Usergroup_users.executeQuery("select ugu.id from Usergroup_users ugu where ugu.user_groupkey = <usergroupkey> AND ugu.userkey= '${requestedby?.id}'")?.size() != 0)

@shivmano , it was a great solution and is working as expected. Can you help me on how you get these classes like com.saviynt.ecm.identitywarehouse.domain.Usergroup_users . Is there any documentation in Saviynt?

shivmano
Regular Contributor III
Regular Contributor III

Glad it worked!. I have not been able to find any documentation related to all available classes either. 

@shivmano , then how are you knowing about these classes??

shivmano
Regular Contributor III
Regular Contributor III

Here are some I have got from other forum posts that might help

com.saviynt.ecm.identitywarehouse.domain.Usergroup_users

com.saviynt.ecm.identitywarehouse.domain.Entitlement_values

com.saviynt.ecm.identitywarehouse.domain.Users

com.saviynt.ecm.identitywarehouse.domain.Accounts

Manu269
All-Star
All-Star

@rituparna_pwc in the if else block you cannot execute a custom query to fetch your requirement.

Regards
Manish Kumar
If the response answered your query, please Accept As Solution and Kudos
.

@Manu269 , how can I achieve a use case like if requestor is part of user group then auto approve/reject?

Manu269
All-Star
All-Star

@rituparna_pwc as per my understanding : 

AutoApprove is not possible, If the requestee and owner is the same, if there is any other owner in the same group, then it can be routed to the other owner, else it would be assigned to admin.

Regards
Manish Kumar
If the response answered your query, please Accept As Solution and Kudos
.

@Manu269 , able to auto approve if requestor is part of usergroup without assigning to other user group people. Our use case is to reject, not able to do that