PARTNERS - Please join us for our upcoming webinar:
Leveraging Intelligent Recommendations for Operational Transformation.
AMS Partners click HERE | EMEA/APJ Partners click HERE

REST; CreateAccountJson;AccountIdPath

vivekrajan1
New Contributor III
New Contributor III

I am getting some extra characters in AccountID field when I use  "accountIdPath": "call1.message.access_hooks.URI"

I want to replace those characters using replaceAll() or replace() function. But EIC is throwing Exception when I use any functions like replaceAll() or replace() or toString  under responseColsToPropsMap{ }. As a result, accountID, Customproperty1, Customproperty3 are throwing exception. Since I dont use any Javascript function im getting result in Customproperty2.

May I know proper syntax to use replace or replaceAll() function within responseColsToPropsMap{ }.

A Sample from CreateAccountJSON:
"accountIdPath": "call1.message.access_hooks.URI",
"responseColsToPropsMap": {
"accountID":"call1.message.access_hooks.URI.toString().replaceAll('xxxyyy','')~#~char",
"customproperty1":"call1.message.access_hooks.URI.toString().replaceAll('xxxyyy','')~#~char",
"customproperty2":"call1.message.email~#~char",
"customproperty3":"call1.message.email.toString().replaceAll('@','H')~#~char"
},

Error 1. 

scription":null,"status":"Success"}}
2024-08-11T01:18:54+05:30-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-6-rlz29-DEBUG-accountId: /api/account/129/xxxyyy
2024-08-11T01:18:54+05:30-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-6-rlz29-DEBUG-responseColsToPropsMap: [accountID:call1.message.xxxyyy.URI.toString().replaceAll('xxxyyy','')~#~char, customproperty1:call1.message.xxxyyy.URI.toString().replaceAll('xxxyyy','')~#~char, customproperty2:call1.message.email~#~char, customproperty3:call1.message.email.toString().replaceAll('@','H')~#~char]
2024-08-11T01:18:54+05:30-ecm-worker-rest.RestUtilService-quartzScheduler_Worker-6-rlz29-DEBUG-Exception in RestUtil.getAt : groovy.lang.MissingPropertyException: No such property: toString() for class: java.lang.String
2024-08-11T01:18:54+05:30-ecm-worker-rest.RestUtilService-quartzScheduler_Worker-6-rlz29-DEBUG-Exception in RestUtil.getAt : groovy.lang.MissingPropertyException: No such property: toString() for class: java.lang.String
2024-08-11T01:18:54+05:30-ecm-worker-rest.RestUtilService-quartzScheduler_Worker-6-rlz29-DEBUG-Exception in RestUtil.getAt : groovy.lang.MissingPropertyException: No such property: toString() for class: java.lang.String
2024-08-11T01:18:54+05:30-ecm-worker-services.SaviyntCommonUtilityService-quartzScheduler_Worker-6-rlz29-DEBUG-Enter getprovisioningMetadata
2024-08-11T01:18:54+05:30-ecm-worker-services.SaviyntCommonUtilityService-quartzScheduler_Worker-6-rlz29-DEBUG-Exit getprovisioningMetadata


=====================================================================================================================

Error 2: 
2024-08-11T01:26:59+05:30-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-7-rlz29-DEBUG-accountId: /api/account/130/xxxyyy
2024-08-11T01:26:59+05:30-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-7-rlz29-DEBUG-responseColsToPropsMap: [accountID:call1.message.xxxyyy.URI.replaceAll('xxxyyy','')~#~char, customproperty1:call1.message.xxxyyy.URI.replaceAll('xxxyyy','')~#~char, customproperty2:call1.message.email~#~char, customproperty3:call1.message.email.replaceAll('@','H')~#~char]
2024-08-11T01:26:59+05:30-ecm-worker-rest.RestUtilService-quartzScheduler_Worker-7-rlz29-DEBUG-Exception in RestUtil.getAt : groovy.lang.MissingPropertyException: No such property: replaceAll('xxxyyy','') for class: java.lang.String
2024-08-11T01:26:59+05:30-ecm-worker-rest.RestUtilService-quartzScheduler_Worker-7-rlz29-DEBUG-Exception in RestUtil.getAt : groovy.lang.MissingPropertyException: No such property: replaceAll('xxxyyy','') for class: java.lang.String
2024-08-11T01:26:59+05:30-ecm-worker-rest.RestUtilService-quartzScheduler_Worker-7-rlz29-DEBUG-Exception in RestUtil.getAt : groovy.lang.MissingPropertyException: No such property: replaceAll('@','H') for class: java.lang.String
2024-08-11T01:26:59+05:30-ecm-worker-services.SaviyntCommonUtilityService-quartzScheduler_Worker-7-rlz29-DEBUG-Enter getprovisioningMetadata
2024-08-11T01:26:59+05:30-ecm-worker-services.SaviyntCommonUtilityService-quartzScheduler_Worker-7-rlz29-DEBUG-Exit getprovisioningMetadata

12 REPLIES 12

rushikeshvartak
All-Star
All-Star

Sample 

accountIdPath":"#CONST#${String id =call1.message.access_hooks.URI; id = id.toString().replace('[','').replace(']','').replace('\"',''); return id}",


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

NM
Honored Contributor
Honored Contributor

Hi @vivekrajan1 , use CONST before to do any sort of manipulation 

#CONST#${DATA}

vivekrajan1
New Contributor III
New Contributor III

If I use #CONST#${DATA} then it just prints whole {DATA} section in AccountID attribute.
Also im not  getting any value in Customproperty1 as well. 

vivekrajan1_0-1723404452739.png

vivekrajan1_1-1723405311382.png

CreateAccount JSON snippet:

"accountIdPath":"#CONST#${String id=call1.message.xxxx.URI; id = id.toString().replaceAll('yyyy',''); return id}",
"responseColsToPropsMap":
{
"customproperty1":"#CONST#${String id =call1.message.xxxx.URI; id = id.toString().replaceAll('yyyy',''); return id}",
"customproperty2":"call1.message.email~#~char"
}

Error Log:

--- ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-2-rlz29-DEBUG-accountId: ${String id=call1.message.xxxx.URI; return id}
--- ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-2-rlz29-DEBUG-responseColsToPropsMap: [customproperty1:#CONST#${String id=call1.message.xxxx.URI; return id}, customproperty2:call1.message.email~#~char]
--- ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-2-rlz29-ERROR-Exception in Iterating responseColsToPropsMap:
ecm-worker--null-rlz29--java.lang.ArrayIndexOutOfBoundsException: 1 at com.saviynt.provisoning.rest.RestProvisioningService$_generateMapFromResponse_closure59.doCall(RestProvisioningService.groovy:9565) at com.saviynt.provisoning.rest.RestProvisioningService.generateMapFromResponse(RestProvisioningService.groovy:9562) at com.saviynt.provisoning.rest.RestProvisioningService$_createAccount_closure14.doCall(RestProvisioningService.groovy:2205) at com.saviynt.provisoning.rest.RestProvisioningService.createAccount(RestProvisioningService.groovy:2002) at com.saviynt.ecm.services.ArsTaskService.createAccountTarget(ArsTaskService.groovy:11842) at com.saviynt.ecm.services.ArsTaskHelperService$_whenTaskTypeIsThreeNewAccountAccess_closure50.doCall(ArsTaskHelperService.groovy:3078) at com.saviynt.ecm.services.ArsTaskHelperService.whenTaskTypeIsThreeNewAccountAccess(ArsTaskHelperService.groovy:3069) at com.saviynt.ecm.services.ArsTaskHelperService$_completeAutoProvTasksUpgraded_closure1.doCall(ArsTaskHelperService.groovy:175) at com.saviynt.ecm.services.ArsTaskHelperService.completeAutoProvTasksUpgraded(ArsTaskHelperService.groovy:160) at MultipleProvisioningJob.execute(MultipleProvisioningJob.groovy:222) at org.quartz.core.JobRunShell.run(JobRunShell.java:199) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:546)

NM
Honored Contributor
Honored Contributor

Try this @vivekrajan1 

"accountIdPath":"#CONST#${String id=response.call1.message.xxxx.URI; id = id.toString().replaceAll('yyyy',''); return id:}",

"responseColsToPropsMap":

{

"customproperty1":"#CONST#${String id =reaponse.call1.message.access_hooks.URI; id = id.toString().replaceAll('yyyy',''); return id:}",

"customproperty2":"call1.message.email~#~char"

}

Ensure the path is right while mapping the value.

vivekrajan1
New Contributor III
New Contributor III

 

I tried all different combinations possible, but no luck. Other than 'Customproperty2' no other Customproperty gets any value(I deliberately gave :(colon) in Customproperty5 just for testing).
No conversion is happening in "accountIdPath" - it just prints the whole {Data} string

Note: If I use this statement "accountIdPath": "call1.message.access_hooks.URI" (without #Const# ) then I am getting proper value with some extra characters, which I want to nullify the extra chars.

CreateAccount JSON Snippet:
"accountIdPath":"#CONST#${String id=response.call1.message.xxxyyy.URI; return id;}",
"responseColsToPropsMap": {
"customproperty1":"#CONST#${String id=call1.message.xxxyyy.URI; return id;}",
"customproperty2":"call1.message.email~#~char",
"customproperty3":"#CONST#${String id=response.call1.message.xxxyyy.URI; return id;}",
"customproperty4":"#CONST#${String id=response.call1.message.xxxyyy.URI;id = id.toString().replaceAll('xxxyyy',''); return id;}",
"customproperty5":"#CONST#${String id=response.call1.message.xxxyyy.URI;id = id.toString().replaceAll('xxxyyy',''); return id:}"
}

Error Snippet:
2024-08-12T01:34:33+05:30-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-1-rlz29-ERROR-Exception in Iterating responseColsToPropsMap:
2024-08-12T01:34:34+05:30-ecm-worker--null-rlz29--java.lang.ArrayIndexOutOfBoundsException
2024-08-12T01:34:33+05:30-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-1-rlz29-ERROR-Exception in Iterating responseColsToPropsMap:
2024-08-12T01:34:34+05:30-ecm-worker--null-rlz29--java.lang.ArrayIndexOutOfBoundsException
2024-08-12T01:34:33+05:30-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-1-rlz29-ERROR-Exception in Iterating responseColsToPropsMap:
2024-08-12T01:34:34+05:30-ecm-worker--null-rlz29--java.lang.ArrayIndexOutOfBoundsException
2024-08-12T01:34:33+05:30-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-1-rlz29-ERROR-Exception in Iterating responseColsToPropsMap:
2024-08-12T01:34:34+05:30-ecm-worker--null-rlz29--java.lang.ArrayIndexOutOfBoundsException

Please share current value and expected value.


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

If I use  "accountIdPath": "call1.message.access_hooks.URI" 

Then it prints value mentioned in screenshot. This is the Current Value.

vivekrajan1_0-1723410208116.png

Expected Value: /api/xxyyzz/138/ - which is, I want to remove "access_hooks" word from it.

"accountIdPath": "#CONST#${String id = call1.message.access_hooks.URI; id = id.toString().replace('access_hooks/', ''); return id;}",


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

No conversion is happening, it just prints whole string as it is in AccountID attribute.

"accountIdPath": "#CONST#${String id = call1.message.access_hooks.URI; id = id.toString().replace('access_hooks/', ''); return id;}",

vivekrajan1_0-1723446433390.png

FYI, I also tried without toString(), replace() function, still it prints whole string without conversion.

"accountIdPath": "#CONST#${String id = call1.message.access_hooks.URI;return id;}",

-- Is this a bug?

"accountIdPath": "call1.message.access_hooks.URI.toString().replace('access_hooks/', '')",


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

Hi @rushikeshvartak same result, prints the whole string again.

But 1 more question, when account gets created, I am getting expected result in Location field under Response Headers. Is there a way to map location field to AccountID attribute? If yes, Could you please provide a sample for this.

vivekrajan1_0-1723489931021.png

 

Can you try same code in customproperty instead of AccountIDPath 

{
	"accountIdPath": "call1.message.id",
	"responseColsToPropsMap": {
		"accountID": "call1.message.id~#~char",
		"customproperty7": "call1.message.UserName~#~char"

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