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

Unable to read Dynamic Attribute in createAccountJSON of AD connection object

varunpuri
Regular Contributor
Regular Contributor

Hi,

We have a dynamic attribute defined at the endpoint level. This attribute is reading value from an SQL query. 

We are using this dynamic attribute in createAccountJSON attribute of AD connection object. The mapping is something like this :

"manager":"${svcAccountOwner}"

where, svcAccountOwner is the dynamic attribute.

But, after running the WSRetry job, following error appear in the logs :

ERROR ldap.SaviyntGroovyLdapService - Error while creating account svc_tAcc_np34 in AD - No such property: svcAccountOwner for class: SimpleTemplateScript30770"

Kindly assist here.

Best Regards,
Varun

16 REPLIES 16

Hsoumare
New Contributor III
New Contributor III

Hello Varunpuri,

Could you please share the sql query and details on how did you set up the dynamic attribute ?

 

Regards

Harouna SOumare

 

varunpuri
Regular Contributor
Regular Contributor

Hello @Hsoumare ,

There are 2 dyanmic attributes here - one is by the name accountNameFromAPI. This is the parent dynamic attribute and is receiving its value from the API call being sent by ServiceNow.

Other dynamic attribute is svcAccountOwner. This is the one whose value should come from an SQL query and whose value depends upon the dynamic attribute named accountNameFromAPI. The SQL query is :

select distinct a.customproperty3 as id from
users u join user_accounts ua on u.userkey = ua.accountkey
join accounts a on a.accountkey = ua.accountkey
join endpoints e on e.endpointkey = a.endpointkey
join (select distinct u.username
from accounts a join accountowners ao on a.accountkey = ao.accountkey
join users u on u.userkey = ao.owneruserkey
where a.name = '${accountNameFromAPI}'
)q on q.username = u.username
WHERE lower(e.endpointname)='activedirectory'
and u.statuskey = 1 and lower(a.status) in ('1','manually provisioned','active')

Best Regards,
Varun

varunpuri
Regular Contributor
Regular Contributor

Hi,

Kindly assist here please.

Best Regards,
Varun

varunpuri
Regular Contributor
Regular Contributor

Hi,

Need some assistance on this thread please.

Best Regards,
Varun

SB
Saviynt Employee
Saviynt Employee

Based on my understanding - assuming the accountNameFromAPI is an existing account. Using the query we are fetching the customproperty3 value of its Owner's. If this understanding is correct, you can use the below query.

Also, once the task gets created, can you please view the task and see if the value for the dynamic attribute is visible to you under task details tab. If the value is visible, you can directly call the dynamic attribute as "${dynattes}". dynattes is the dynamic attribute name I created.

select a.customproperty3 as ID from accounts a inner join user_accounts ua on ua.accountkey=a.accountkey and ua.userkey in (select ao.owneruserkey from accountowners ao inner join accounts a on a.accountkey=ao.accountkey where name = 'CN=00000005,OU=Users,OU=CONNQA,OU=SaviyntTeams,DC=saviyntlabs,DC=org' and endpointkey='62') and a.endpointkey=62


Regards,
Sahil

varunpuri
Regular Contributor
Regular Contributor

Hello @SB 

The parent dynamic attribute is visible both under the task details as well as the request details. Snapshot below. But the dynamic attribute which I am trying to calculate based on the parent attribute value is not visible there. The logs show this error :

Error while creating account in AD - No such property: svcAccountOwner for class: SimpleTemplateScript240

The mapping which I have done in the CreateAccountJSON is : "manager": "${svcAccountOwner}"

And svcAccountOwner is the dynamic attribute which is of type Single Select from SQL and is referring to accountNameFromAPI (which is another dynamic attribute) as its parent attribute.

varunpuri_0-1684487483275.png

varunpuri_1-1684487560839.png

Kindly assist further.

Best Regards,
Varun

SB
Saviynt Employee
Saviynt Employee

Can you create a support ticket for this. You can also add a comment to assign the ticket to me for further troubleshooting.


Regards,
Sahil

varunpuri
Regular Contributor
Regular Contributor

Hello @SB ,

I have already opened a support ticket for this - https://saviynt.freshdesk.com/support/tickets/1627406

And we are conversing already there. The only difference is that I am trying to explore 2 different solutions for the same problem. In the ticket, we are conversing over a piece of Groovy script/java code whereas on this thread I am trying to resolve the same problem through dynamic attributes.

In an earlier version, I have used the dynamic attribute for calculating the AD attribute in CreateAccountJSON mapping. But I see that the same is not working in this version (23.2). I hope I am not making any mistake.

Best Regards,
Varun

SB
Saviynt Employee
Saviynt Employee

Yes, I understand but this issue will require another support ticket if we also need to explore Dynamic attribute solution.


Regards,
Sahil

varunpuri
Regular Contributor
Regular Contributor

@SB - I have opened another ticket for this thread - #1631027 Unable to read Dynamic Attribute in createAccountJSON of AD connection object

Best Regards,
Varun

SB
Saviynt Employee
Saviynt Employee

Thank you. I will have this checked.


Regards,
Sahil

Share dynamica attribute screenshot 


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

@ehrushikesh - 

Snapshot of parent dynamic attribute : accountNameFromAPI 

varunpuri_0-1685418532038.png

varunpuri_1-1685418571198.png

Snapshot of dependent/child dynamic attribute : svcAccountOwner

varunpuri_2-1685418628510.png

varunpuri_3-1685418660016.png

 

 

Try ${customproperty5}


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

@rushikeshvartak - getting this error :

Error while creating account in AD - No such property: customproperty5 for class: SimpleTemplateScript10461

Best Regards,
Varun

SB
Saviynt Employee
Saviynt Employee
The attribute type String for Parent, will not work in this case and the attribute type has to be either ENUM or SQL type. Also, the Dynamic attribute will work if the request is getting generated from UI. In case the request gets generated from api, the Dynamic attribute value will not get calculated.
 
When request is raised from external source, it is expected that value for the DA is pre-calculated and passed as part of the request body.

Regards,
Sahil