Forum

Thread tagged as: Question, Addons

Trigger a custom action on contact form submission?

Hi, I have a client that is using the Perch Forms addon for a contact form. They would like an API call made to their SalesForce CRM whenever someone fills out a contact form. I am a programmer so I know how to make the call to the API, but what I don't know is if it's possible to insert my own code into the processing of a perch form. I see documentation on customizing the display of the form, but nowhere do I see any mention of doing an "event" or "action" (or something like that) for custom operations upon successful form completion. Or even just a file somewhere I can plop my own php code into. Is this possible to do?

(fwiw, this is a "normal" perch site, not using Perch Runway).

Thanks, Jordan

Web Concentrate

Web Concentrate 0 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Yes, you can do that. The simplest way is probably to create a skeleton app to also listen for the form submission.

/perch/addons/apps/letsche_salesforce/runtime.php

Include it in your apps.php and set the form to submit to it:

app="perch_forms letsche_salesforce"

Then add a form handler in the runtime.php

function letsche_salesforce_form_handler($SubmittedForm)
{
    if ($SubmittedForm->validate()) {
        // your code here
        // fields are $SubmittedForm->data
    }
}
Simon Clay

Simon Clay 127 points

Hi Jordan, did you go this working? Would you be able to share your method by any chance, or could I contact you to commission the work to you?. I too have a client who would like to send info into SalesForce. Many thanks.