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

Whom to request from advance query SAV role

BG_IAM
New Contributor III
New Contributor III

Hello,

I'm encountering an issue with an advanced query in the SAV role. I need to determine whom to request for the following criteria in JSON format:

1. For managers where the employeeType is either BOT or External.
AND
2. For the manager's manager where the username starts with 'Guest'.
The query I'm using isn't producing the expected results. Any ideas on how to address this scenario?

BG_IAM_0-1711029399795.png

 

 

[{    "for": "UpdateUserRequest",    "query": "SELECT a FROM Users a WHERE (SELECT DISTINCT a.userkey 
 FROM Users a 
 WHERE a.manager = '${users.id}' 
   AND a.employeeType IN ('BOT','External')
UNION ALL SELECT ua.userkey 
 FROM Users ua 
 JOIN Users ua1 ON ua1.userkey = ua.manager 
 JOIN Users ua2 ON ua2.userkey = ua1.manager 
 WHERE ua.username LIKE 'Guest%' 
   AND ua2.userkey = '${users.id}')"}]

 

thx 

3 REPLIES 3

CR
Regular Contributor III
Regular Contributor III

this query working in Data analyzer ? u want result in user update request page? or requets page?


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

PremMahadikar
Regular Contributor III
Regular Contributor III

Hi @BG_IAM ,

Union will not work here.

I have changed the query and its working for me. Please try it.

[{"for": "UpdateUserRequest","query":"select a from Users a where (a.employeeType IN ('BOT','External') or a.employeeType like 'Guest%') AND (a.manager='${users.id}' or a.manager in (select distinct a from Users a where a.manager = '${users.id}'))"}]

 

If this reply answers your question, please consider selecting Accept As Solution and hit kudos.

rushikeshvartak
All-Star
All-Star

SELECT a FROM Users a
WHERE (
SELECT DISTINCT a.userkey
FROM Users a1
WHERE a1.manager = '${users.id}'
AND a1.employeeType IN ('BOT','External')
UNION ALL
SELECT ua.userkey
FROM Users ua
JOIN Users ua1 ON ua1.userkey = ua.manager
JOIN Users ua2 ON ua2.userkey = ua1.manager
WHERE ua.username LIKE 'Guest%'
AND ua2.userkey = '${users.id}'
)


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