Salesforce integration - using custom form's Call REST Resource to add contact


(Robin Bilney) #1

Hi,

I’m trying to integrate a custom form with Salesforce using the REST API but I’m having troubles with the response from the custom form’s HTTP call.

The response of the HTTP request is acting like a GET call and not a POST, even though the HTTP Request method is POST in the settings…

The response that is returned contains contacts that are currently in Salesforce, but it doesn’t add the contact.

Has anyone had any experience with this sort of thing?

Thanks,
Robin


(Bart Banda) #2

Can you share some more details of your implementation? A screenshot of your Call REST submission action perhaps?

Are you saying that the request to the Salesforce API is being made as a GET rather than a POST?


(Robin Bilney) #3

I’m trying to add a Contact to salesforce database by calling a REST resource when a Custom Form is submitted and sending a POST HTTP Request to:

https://eu9.lightning.force.com/services/data/v41.0/sobjects/Contact

With the request body containing the JSON array:

{“FirstName”:“Matrix”,“LastName”:“Test”}

If successful, I’d expect the following type of response:

{ “id” : “0030O000023k1LkQAI”, “success” : true, “errors” : [ ], “warnings” : [ ] }

However, the HTTP response I get from salesforce (which is stored in a session variable) is what I would expect to get from a GET request (listing all the recent contacts).

Here’s a screenshot of REST call:

Here a screenshot of the Run Test:

(token blacked out)

Matrix is telling me that it was a POST request, both when I run a test and when I print out the response but Salesforce is returning a response as if it was a GET call. The status code in the response is 200 (OK) instead of 201 (Created) as well.

Are there Matrix logs I can check or do I need access to web server logs?

I’m on Matrix v5.4.0.1

Thanks,
Robin


(Bart Banda) #4

That’s interesting. Not sure if the logs will give you anything more than what you see there, but have you tried printing all of the response data to the front-end to see what Salesforce is giving you back? Might be some clues there?

Also, have you tested that doing the exact same call in something like Postman gives you the right result? Maybe the authenticated user doesn’t have access to create the records in Salesfoce?