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

Rest Connector - Extracting Enum Type Values from JSON Response map to saviynt attribute

AravindR
New Contributor
New Contributor

Hello everyone,
I'm looking for a way to extract the string "Active" from the "ObjectStatus" key in the following JSON response and map it to the Saviynt attribute in ImportAccountJson.

 responseText:[{"Name":"ABCD.Aravind","UserName":"Aravind","DisplayName":"Aravind","ObjectStatus":"System.ConfigItem.ObjectStatusEnum.Active"},{"response":"Success","Description":"Accounts reconciled successfully "}], cookies:[], statusCode:200]

I've attempted the following approach:
#CONST#${String S = response.ObjectStatus.split('.')[3]; return S}

#CONST#${response.call1.message.ObjectStatus.substring(ObjectStatus.lastIndexOf('.') + 1)}~#~char

#CONST#${responseText.ObjectStatus.substring(ObjectStatus.lastIndexOf('.') + 1)}~#~char


Has anyone encountered a similar situation with extracting values from enum types in JSON responses? Any suggestions on how to accomplish this would be greatly appreciated.

Thank you,

Aravind.

4 REPLIES 4

CR
Regular Contributor III
Regular Contributor III

try like below, it will help full

"customproperty11": "#CONST#${(response['Custom Fields'][0].value == '') ? '' : response['Custom Fields'][0].value.substring(response['Custom Fields'][0].value.indexOf('(') + 1, response['Custom Fields'][0].value.indexOf('_'))}~#~char",


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

AravindR
New Contributor
New Contributor

Hi,
I am not required If else condition logic. I need to extract the 'Active' string from the ObjectStatus Key, i.e., 'System. ConfigItem.ObjectStatusEnum.Active'

Regards,
Aravind.

#CONST#${responseText.find { it.Name == 'ABCD.Aravind' }.ObjectStatus.split("\\.")[3]}~#~char
 

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

AravindR
New Contributor
New Contributor

Hi,
#CONST#${responseText.find { it.Name == 'ABCD.Aravind' }.ObjectStatus.split("\\.")[3]}~#~char ,This is also not getting the "active" string from ObjectStatus. In CustomProperty19, it is being populated, as shown below.

AravindR_0-1711477294546.png

I required the  'Active' string from ObjectStatus in the ImportAccount scenario.

Regards,
Aravind