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?


(Innes Zenati) #7

@rbilney did you ever get this working as I am trying to set up the exact same process?

Thanks
Innes


(Robin Bilney) #8

Sorry @innesz, I don’t think I got any futher than this.


(Innes Zenati) #9

Ah thats a shame! We have implemented this on our external ScotLIS property / land search site but working on Squiz is totally different and dont have the dev support the IT guys do. Will get together with a colleague and put a plan in place. Once we do, and its working I’ll make sure to pass on what we done.


(Tbaatar) #10

Hi Innesz,

Do you have a test end point and header info to add contact?
I’m curios why this isn’t working. I have successfully implemented with AutoPilot, SendGrid and Postmark.


(Innes Zenati) #11

Hi @tbaatar,

Sorry for not coming back to you sooner. Its not a matter of this not working, it’s the fact that I am apprehensive around setting this up without the knowledge of not previously doing it.

I think the best option for us is the submission action / rest resource to add contact but haven’t implemented anything as of yet. I have asked for dev support from Squiz which I’m hoping we will get as this will save 2 members of a team from copying and pasting data into Salesforce every day!


(Innes Zenati) #13

Thanks Nick, we have successfully been able to set up a number of our forms in this way but going forward our intention is to use Squiz Connect integration platform, which makes this so much easier. We currently have this implemented for our mailing list sign up form which integrates with a custom record within Salesforce. Thanks