Saviynt unveils its cutting-edge Intelligence Suite products to revolutionize Identity Security!
Click HERE to see how Saviynt Intelligence is transforming the industry.
Saviynt Copilot Icon

Issue with Passing Validity (Dynamic Attribute) to Account CustomProperty in CreateAccountJSON API

alvian
Regular Contributor
Regular Contributor

 

Hi folks,

I’m currently working with the following createAccountJSON:

 

 
{ "accountIdPath": "accountName", "ColsToPropsMap": { "customproperty10": "${(requestAccessAttributes?.get('Validity') == '1Month') ? Calendar.getInstance().with { it.add(Calendar.DAY_OF_YEAR, 30); it.time }.format('yyyy-MM-dd HH:mm:ss') : (requestAccessAttributes?.get('Validity') == '3Month') ? Calendar.getInstance().with { it.add(Calendar.DAY_OF_YEAR, 90); it.time }.format('yyyy-MM-dd HH:mm:ss') : (requestAccessAttributes?.get('Validity') == '6Month') ? Calendar.getInstance().with { it.add(Calendar.DAY_OF_YEAR, 180); it.time }.format('yyyy-MM-dd HH:mm:ss') : (requestAccessAttributes?.get('Validity') == '1year') ? Calendar.getInstance().with { it.add(Calendar.DAY_OF_YEAR, 365); it.time }.format('yyyy-MM-dd HH:mm:ss') : ''}~#~char" }, "dateFormat": "yyyy-MM-dd'T'HH:mm:ssXXX", "call": [ { "name": "call1", "connection": "userAuth", "url": "https://url/v1/post-users-save", "httpMethod": "POST", "httpParams": "{ \"name\": \"${user.displayname}\", \"email\": \"${user.email}\", \"productOwner\": \"${requestAccessAttributes?.get('productowner').toString().replace(',', ';')}\", \"role\": \"${requestAccessAttributes?.get('Role')}\", \"validity\": \"${(requestAccessAttributes?.get('Validity') == '1Month') ? Calendar.getInstance().with { it.add(Calendar.DAY_OF_YEAR, 30); it.time }.format('yyyy-MM-dd HH:mm:ss') : (requestAccessAttributes?.get('Validity') == '3Month') ? Calendar.getInstance().with { it.add(Calendar.DAY_OF_YEAR, 90); it.time }.format('yyyy-MM-dd HH:mm:ss') : (requestAccessAttributes?.get('Validity') == '6Month') ? Calendar.getInstance().with { it.add(Calendar.DAY_OF_YEAR, 180); it.time }.format('yyyy-MM-dd HH:mm:ss') : (requestAccessAttributes?.get('Validity') == '1year') ? Calendar.getInstance().with { it.add(Calendar.DAY_OF_YEAR, 365); it.time }.format('yyyy-MM-dd HH:mm:ss') : ''}\" }", "httpHeaders": { "Authorization": "${access_token}", "Accept": "application/json", "accept-encoding": "" }, "httpContentType": "application/json", "successResponses": { "statusCode": [ 204 ] } } ] }

The API response is no-content, and I want to capture the validity value that I send in the API call into the account's customproperty10.

Currently, I’ve set the ColsToPropsMap to map customproperty10 using the same logic for validity. However, it doesn’t seem to work as expected. Can someone help guide me on how to properly capture and map the validity field sent via the API call to customproperty10?

Thanks in advance!

12 REPLIES 12

NM
Honored Contributor III
Honored Contributor III

@alvian share the api response.


If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'

alvian
Regular Contributor
Regular Contributor

the API just response a status code 204 with no content 

NM
Honored Contributor III
Honored Contributor III

@alvian colstoprop is to used to set the value recieved in response.

Workaround 

I believe validity is a DA so map the validity account field to customproperty10 it will work and map the value.


If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'

alvian
Regular Contributor
Regular Contributor

Yes @NM , I understand that DA values can be automatically mapped to account attributes. However, what I need is to populate the account attribute with the variable ${(requestAccessAttributes?.get('Validity') == '1Month') ? Calendar.getInstance().with { it.add(Calendar.DAY_OF_YEAR, 30); it.time }.format('yyyy-MM-dd HH:mm:ss')} that I sent to the target.

here is the DA settings

 alvian_0-1729074603208.png

 

 

NM
Honored Contributor III
Honored Contributor III

@alvian can we you can retrieve the value that you are sending ?

For single user get api?


If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'

alvian
Regular Contributor
Regular Contributor

Ohh okay you mean to create another call to retrieve all the data that I need yap ?

I've add an another call to get that data 

this is the sample response:

{"name":"Avendor1","email":"Avendor1@example.com","productOwner":"P1","role":"role1","validity":"2025-04-14 11:11:02"},"code":200},"statusCode":200,"description":null,"status":"Success"}} 

I also create this responseColsToPropsMap
"responseColsToPropsMap": {
"customproperty3": "call2.message.validity~#~char",
"customproperty4": "call2.message.email~#~char",
"customproperty10": "call2.message.validity.substring(0, 10)~#~char"
},
but somehow there no value is added into that customproperty, any idea?



NM
Honored Contributor III
Honored Contributor III

@alvian just try this much 

customproperty10": "call2.message.validity~#~char"


If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'

alvian
Regular Contributor
Regular Contributor

I want to get yyyy-mm-dd that's why I put .substring(0,9) 😅

NM
Honored Contributor III
Honored Contributor III

@alvian use CONST you will find the sample in developer handbook

 

If you found the solution helpful please click on kudos button and accept solution.

Thanks.


If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'

NM
Honored Contributor III
Honored Contributor III

@alvian did the below suggestion worked?


If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'

alvian
Regular Contributor
Regular Contributor

"customproperty10": "#CONST#${call2.message.validity?.substring(0, 10)}~#~char"

now I'm using this parameter but is not work, what I confused is the same variable CONST is work on import account 

NM
Honored Contributor III
Honored Contributor III

@alvian try this s

 

    "customproperty10": "#CONST#${String acctId = response.call1.message.validity; acctId = acctId.substring(0,9 ); return acctId}~#~char"


If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'