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

How to use organization attributes in custom query of workflow.

Padmavathi
Regular Contributor
Regular Contributor

Hi Team, 

Can anyone please help us the below requirement.

How to get organization attributes dynamically like organization name, primary organization contact, organization custom property in organization workflow (custom assignment --> custom query).

ex: select primaryvendorcontact from customer where customername = 'organization name'

Thanks in advance!

 

 

18 REPLIES 18

PremMahadikar
Valued Contributor II
Valued Contributor II

Hi @Padmavathi ,

From the documentation, I don't think we can use organization objects in custom query (under custom assignment) V23.X

Workflow components for customquery

If you are using the workflow for organization modification under Global config and want to select specific approvers, you can use ‘Access Approval’ and play with Rank.

 

Padmavathi
Regular Contributor
Regular Contributor

Hi @PremMahadikar 

Thanks for the response!

Yeah, we are able to get the rank 1 owners of the organization with the below query. But we need organization name dynamically.

ex: select oo.userkey as userkey from organization_owners oo inner join customer c on oo.customerkey = c.customerkey where oo.rank = 1 and c.customername = 'XYZ'

Could you please help us that, how can we achieve the organization name attribute value dynamically in the above query.

Thanks in advance!

PremMahadikar
Valued Contributor II
Valued Contributor II

@Padmavathi 

Can you try c.CUSTOMERKEY=${REQUESTACCESSOBJ.id} . This should select the respective organization name.

 

 

Padmavathi
Regular Contributor
Regular Contributor

Hi @PremMahadikar 

Thanks for the reply!

we have used query like below. 

select oo.userkey as userkey from organization_owners oo inner join customer c on oo.customerkey = c.customerkey where oo.rank = 1 and c.CUSTOMERKEY=${REQUESTACCESSOBJ.id}

Now it is picking the correct organization, but instead of going to Rank1 Owners it is going to admin.

Can you please suggest the functionality here?

Thanks in advance!

 

PremMahadikar
Valued Contributor II
Valued Contributor II

@Padmavathi ,

I think ${REQUESTACCESSOBJ.id} can only be used for entitlement or role owner only. As mentioned above, there is no organization object to achieve this inside custom query as per the documentation.

If you are using the workflow for 'Organization modification approval under global configurations', then you can use 'Access approval' as workflow component and play with rank for limiting owner selection.

If you are using the organization approval workflow for user request, then use the below query: (This will create an approver task for the organization owner tagged to the requested user for account/access)

SELECT o.userkey FROM organization_owners o JOIN customer c ON o.customerkey =c. customerkey WHERE c.customerkey = ${user.customer.id}

 

Padmavathi
Regular Contributor
Regular Contributor

Hi @PremMahadikar 

Thanks for your response!

We are using the workflow for 'Organization modification approval under global configurations'.

As per your suggestion we used 'Access approval' as workflow component and took rank1 owner. 

I am the rank1 owner in organization, that means if I request it should go for auto approval correct, instead it is going to admin.

Padmavathi_0-1709712331496.png

Can you please help us, that did we missed anything?

Thanks in advance! 

PremMahadikar
Valued Contributor II
Valued Contributor II

@Padmavathi ,

This is the current functionality (When I tried, it's even same in 24.x). Your workflow is correct.

- Case: If there are two owners with the same/different rank and in the workflow, it's 'All owner' configured: This time when one of the owners is updating an organization, the expectation is to route it to another owner.

- Case: There is only one owner for an organization or if there are multiple owners with different ranks and in workflow, it's 'Owner having Rank 1' is configured: This time it routes the request to an admin. (This is the same functionality that you faced)

 

You can look into 'help' inside the workflow configuration for Saviynt supported variables and expressions.

 

Currently, Organisation/customer variables and expression in workflow are not supported as per the documentation

 

Hi @PremMahadikar 

Thanks for the Detailed Response!

I will check and get back to you.

Regards,

Padmavathi

PremMahadikar
Valued Contributor II
Valued Contributor II

Hi @Padmavathi,

I found an article for you - Exposing Organization Object Variables in Workflows

I haven't tested this personally. But looks like it should work. If this doesn't work, please raise a support ticket referring to this article.

Padmavathi
Regular Contributor
Regular Contributor

Hi @PremMahadikar 

Thanks for the Information!

Sure, will check on it.

Regards

Padmavathi

 

Where is workflow attached & from which tile request is submitted ?


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

Padmavathi
Regular Contributor
Regular Contributor

Hi @PremMahadikar @rushikeshvartak 

we have tried below ways by using this article details - Exposing Organization Object Variables in Workflows

1. Code used under if else block like below:

Here, the request is going going to rejected 

1.  '${organization.ownerRank1}' == '${requestedby.username}'

2. '${organization.ownerRank1}' == requestedby.username

3. '${user.username}' == '${organization.ownerRank1}'

4. user.username == '${organization.ownerRank1}'

 

Padmavathi_0-1710335512249.png

Method not found error if we use below code:

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

 Internal Server Error. Please check for the below code:

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

2. used custom query like below two ways:

Here request is going to the admin

1. select oo.userkey as userkey from organization_owners oo inner join customer c on oo.customerkey = c.customerkey where oo.rank = 1 and c.customername = ${organizationName} 

(or)

2. select userkey from users where userkey=(
select userkey from organization_owners where userkey=${organizationOwner.id} and rank = ${organization.ownerRank1}
and customerkey=${organization.id}

our requirement is to get auto approval, if there is only one rank 1 owner for an organization or if there are multiple owners with different ranks and in workflow, it's 'Owner having Rank 1' is configured.

Note: As per your suggestion we used 'Access approval' as workflow component and took rank1 owner this is working but for self request (rank 1 owner only requests) it is going to admin.

Please let me know how we can get the functionality and let me know if I missed anything in the query or in if else condition.

Thanks in advance!

 

Raghu
Honored Contributor
Honored Contributor

you can use below

SELECT o.userkey FROM organization_owners o JOIN customer c ON o.customerkey =c. customerkey WHERE c.customerkey = ${user.customer.id}


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

Hi @PremMahadikar @Darshanjain @Raghu @rushikeshvartak 

How to get organization rank1 owner key or username in the if else block?

We have tried using this attribute ${organization.ownerRank1} but didn't help.

Also, can anyone please help us what is the output of the attribute? ${organization.ownerRank1}

Thanks in advance.

Regards

Padmavathi

Raghu
Honored Contributor
Honored Contributor

@Padmavathi  If else block we can 't get condition


if block u can use below condition and any you have CQ then use it custom assigment for ownerRank1 get if else -> (organization.ownerRank1 != null ) and organizationOwner.size() > 0
custom assignment -> select oo.userkey as userkey from organization_owners oo inner join customer c on oo.customerkey = c.customerkey where oo.rank = 1 and c.customername = ${organization.customername}


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

Padmavathi
Regular Contributor
Regular Contributor

Hi @Raghu 

Thanks for the response!

We tried this query as per your suggestion.

SELECT o.userkey FROM organization_owners o JOIN customer c ON o.customerkey =c. customerkey WHERE c.customerkey = ${user.customer.id}

But didn't get response as expected. the request is going to admin even another rank1 owner is there.

our requirement is to get auto approval, if there is only one rank 1 owner for an organization or if there are multiple owners with different ranks and in workflow, it's 'Owner having Rank 1' is configured.

Note: If we hard code the organization name the request is auto approving. But here we need dynamic attributes for organization to get organization name dynamically.

 ex: select oo.userkey as userkey from organization_owners oo inner join customer c on oo.customerkey = c.customerkey where oo.rank = 1 and c.customername = 'XYZ'

Please let me know, if you need any further details.

Thanks in advance!

 

 

Hi @Padmavathi 

Its the expected Behavior as if there are no more owners it will go to admin for approval. only for manager block it auto approves rest all it goes to admin.

 

Thanks

Darshan

 

 

Thanks

Darshan

Padmavathi
Regular Contributor
Regular Contributor

Hi @Darshanjain @Raghu @rushikeshvartak @PremMahadikar , 

Thanks all of you for the responses and guidance!

We were able to achieve the issue by using this dynamic variable ${organization.customername}

Thanks @PremMahadikar for providing the article link Exposing Organization Object Variables in

Workflows

we used below query to get the expected result.

select oo.userkey as userkey from organization_owners oo inner join customer c on oo.customerkey = c.customerkey where oo.rank = 1 and c.customername = ${organization.customername}

Regards,

Padmavathi.