Leveraging Intelligent Recommendations for Operational Transformation. AMS Partners click HERE | EMEA/APJ Partners click HERE |
08/10/2024 01:43 PM
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
08/10/2024 02:28 PM
Sample
accountIdPath":"#CONST#${String id =call1.message.access_hooks.URI; id = id.toString().replace('[','').replace(']','').replace('\"',''); return id}",
08/10/2024 10:16 PM
Hi @vivekrajan1 , use CONST before to do any sort of manipulation
#CONST#${DATA}
08/11/2024 12:36 PM - edited 08/11/2024 12:42 PM
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.
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)
08/11/2024 12:42 PM
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.
08/11/2024 01:27 PM
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
08/11/2024 02:01 PM
Please share current value and expected value.
08/11/2024 02:06 PM
If I use "accountIdPath": "call1.message.access_hooks.URI"
Then it prints value mentioned in screenshot. This is the Current Value.
Expected Value: /api/xxyyzz/138/ - which is, I want to remove "access_hooks" word from it.
08/11/2024 02:21 PM
"accountIdPath": "#CONST#${String id = call1.message.access_hooks.URI; id = id.toString().replace('access_hooks/', ''); return id;}",
08/12/2024 12:12 AM
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;}",
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?
08/12/2024 05:27 AM
"accountIdPath": "call1.message.access_hooks.URI.toString().replace('access_hooks/', '')",
08/12/2024 12:16 PM
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.
08/12/2024 01:52 PM
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"