and more in a single search tool across platforms. Read the announcement here. |
05/05/2023 06:13 AM - edited 05/05/2023 06:16 AM
Hello,
I tried the below but it doesn't seem to make the second call. Is it possible to only make the second call based on the response from the first call? I cannot use status code because its always 200 so I need to use the error message of call1
I'm basically specifically asking about "connection": "${if((response.call1.message.data.errors.errorMessage).equals('The user already exists.')) {'acctAuth'} else {''}}",
{
"accountIdPath": "accountName",
"responseColsToPropsMap": {},
"call": [
{
"name": "call1",
"connection": "acctAuth",
"url": "https://domain.com/v1/users/services?notify=false",
"httpMethod": "POST",
"httpParams": "{\"records\": [{\"FirstName\": \"${user.firstname}\",\"LastName\": \"${user.lastname}\",\"Name\": \"${user.displayname}\",\"Email\": \"${user.email}\",\"LicenseType\":\"Full\",\"SFDCUserName\":\"${user.email}\",\"permissionBundles\":[\"DEFAULT_BUNDLE\"],\"IsActiveUser\":\"true\"}]}",
"httpHeaders": {
"Accept": "application/json",
"accesskey": "${access_token}"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200
]
}
},
{
"name": "call2",
"connection": "${if((response.call1.message.data.errors.errorMessage).equals('The user already exists.')) {'acctAuth'} else {''}}",
"url": "https://domain.com/v1/users/services?key=SFDCUserName",
"httpMethod": "PUT",
"httpParams": "{\"records\": [{\"FirstName\": \"${user.firstname}\",\"LastName\": \"${user.lastname}\",\"Name\": \"${user.displayname}\",\"Email\": \"${user.email}\",\"LicenseType\":\"Full\",\"SFDCUserName\":\"${user.email}\",\"permissionBundles\":[\"DEFAULT_BUNDLE\"],\"IsActiveUser\":\"true\"}]}",
"httpHeaders": {
"Accept": "application/json",
"accesskey": "${access_token}"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200
]
}
}
]
}
Sample response:
{
"result": false,
"errorCode": "GU_2401",
"errorDesc": "User bulk create is completed with failures.",
"localizedErrorDesc": null,
"requestId": "bec8bbe2-0dd6-45a3-83a5-6b8c1d7229b7",
"data": {
"status": "FAILED",
"successCount": 0,
"failureCount": 1,
"records": [],
"errors": [
{
"record": {
"IsActiveUser": true,
"Timezone": "America/Los_Angeles",
"IsSuperAdmin": false,
"Email": "jdoe@domain.com",
"GainsightLicenseEnabled": false,
"FirstName": "John",
"permissionBundles": [
"DEFAULT_BUNDLE"
],
"SFDCUserName": "jdoe@domain.com",
"SystemType": "Internal",
"LastName": "Doe",
"CurrencyIsoCode": "USD",
"LicenseType": "Full",
"Name": "John Doe"
},
"field": null,
"invalidValue": null,
"errorCode": "GU_1105",
"errorMessage": "The user already exists."
}
],
"success": false
},
"message": null,
"localizedMessage": null
}
Solved! Go to Solution.
05/08/2023 06:54 AM
Bump for visibility
05/15/2023 12:17 AM
Hi @ZA
Please try the below snippet in the call2 of your json
"connection": "${response.call1.message.data.errors[0].errorMessage == 'The user already exists.'?'acctAuth':''}",
Thank you
Vedanth B.K
05/15/2023 07:17 AM
Ah thank you didn't catch that it was in an array.