Using Curl action with GSheet Save action??

How to send form data to Salesforce when using a Google Sheets save action.

Overview

The issue occurs because the form data is stored in a Gsheet array, which is not directly accessible by the standard cURL action.
Add a custom code action before the cURL action to copy the values from the Gsheet array into the standard form data array, ensuring correct syntax without unnecessary quotes.

Answered
lu luxhodge 02 Mar, 2016
Question on saving contact form info to salesforce: my contact form saves the data to a database and to a google docs sheet when submitted. Now I want to add a save to our salesforce DB. Is that possible? I have used the curl action before to save data successfully to salesforce. However, this data is in a Gsheet array because of the google docs sheet save action. Would I need to use the [GH] custom curl action for this? I tried to find the download for that action, but the downloads page on greyhead.net is not coming up any longer. I tried using some php to copy the form Gsheet values into the normal form array, but it did not work. The form is a single page, so maybe I can't copy the form values from the session before the rest of the actions run. I will keep trying.

This is the forum post I referenced for the salesforce data write: http://www.chronoengine.com/faqs/61-cfv4/cfv4-tutorials/4112-how-can-i-send-form-data-to-%3Cspan%20class=

Has anyone tried this before and if they have, what did you use?

Thanks in advance for any help/advice anyone can give me.

Erik
lu luxhodge 02 Mar, 2016
Answer
I solved my own problem here. I added a custom code action right before the CURL action to grab the values from the Gsheet array in the session and put them into a standard $form->data array. Here is what it looks like:

<?php
$form->data['oid'] = '00xxxxxxxxxxx';
$form->data['retURL'] = 'http://www.mydomain.com';
$form->data['debug'] = '0'; // change to 1 to enable debugging
$form->data['debugEmail'] = 'myemail@mydomain.com';
$form->data['firstName']=$form->data[Gsheet][firstName];
$form->data['lastName']=$form->data[Gsheet][lastName];
?>

My mistake was that I had single quotes around the Gsheet and firstName, etc. names in the array assignment. The write to Salesforce works great once I fixed that problem.
Gr GreyHead 02 Mar, 2016
Hi Erik,

I haven't tested but I think that you can use the 'dot' syntax in the cURL action e.g. param=Gsheet.firstName - but your method is fine.

Bob

PS Sorry about the greyhead.net site - it has got some serious problems with SEF URLs that I've failed to solve. All the content is there - just not accessible. If you need anything, you can PM me to ask for a link.
This topic is locked and no more replies can be posted.