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

Make second call depending on call1 response message

ZA
New Contributor III
New Contributor III

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
}

 

 

3 REPLIES 3

ZA
New Contributor III
New Contributor III

Bump for visibility

Vedanth_BK
Saviynt Employee
Saviynt Employee

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

 

ZA
New Contributor III
New Contributor III

Ah thank you didn't catch that it was in an array.