You need to sign in to do that
Don't have an account?
ventorero
Send lead data to 3party application (Pardot)
Hi There-
We are using Pardot for marketing automation and currrently the sync works from Pardot to Salesforce automatically and from Salesforce to Pardot with a button click that executes a java scrpit that pushes lead basic data to our Pardot instance
**
window.location = 'https://blablabla/email/{!Lead.Email}?lead_id={!Lead.Id}&sessionid={!$Api.Session_ID}&serverurl={!$Api.Partner_Server_URL_90}&redirect_location='+window.location
**
Im requesting for your help to translate this JS to apex which will work every time 1 or more leads are created in salesforce?
Please assist
Maor
We are using Pardot for marketing automation and currrently the sync works from Pardot to Salesforce automatically and from Salesforce to Pardot with a button click that executes a java scrpit that pushes lead basic data to our Pardot instance
**
window.location = 'https://blablabla/email/{!Lead.Email}?lead_id={!Lead.Id}&sessionid={!$Api.Session_ID}&serverurl={!$Api.Partner_Server_URL_90}&redirect_location='+window.location
**
Im requesting for your help to translate this JS to apex which will work every time 1 or more leads are created in salesforce?
Please assist
Maor
So from the trigge you need to call a @future(callout=true) method whcih will do a HTTP post action with the details of lead what you want to push. To stop this code getting executed on every time a lead is updated. You can created a check box field when that is ticked in the record whcih reads as "Send to Padrot" then your code push those leads or you can have a lead status whcih user again sets as "Push to Padrot".
The other solution is to have a blank visual force page with a standard controller as Lead and a custom controller extension whcih has funuctionality to push to Padrot. Then the code returns you to the Detail view page of that lead again.
To clarify for other non-Pardot users. When a lead or contact is saved to salesforce without an email address, then later edited to have an email address, this record does not automatically get sync'd to Pardot. Pardot's (lame) solution is to have the end user know that this short coming exists and they should push a button to add the lead or contact to Pardot. If you create a lead or contact in salesforce and enter an email address at the time you're creating the lead or contact for the first time, that record WILL sync to Pardot. It's only when the record was saved first without an email and later an email is added.
We've setup an after update trigger to use a @future callout whenever a lead's email address is null and the new value is not null. We've used the url that you put in your original question and populated the variables in the trigger. What we're finding though is that the debug log shows a successful 200 result, but the lead is not being populated in Pardot. However, if we copy the url generated (from the debug log) that's being called and we paste that into our browser, it works and the lead is created in Pardot. We're still trying to figure out why it works from a browser, but via an @future callout.
http://salesforce.stackexchange.com/questions/51368/httpresponse-statuscode-200-but-3rd-party-request-pardot-not-made