SOLVED

Marketo form in Salesforce Partner Community

Go to solution
Anonymous
Not applicable

Marketo form in Salesforce Partner Community

Hi,

I have a question hopefully someone can answer. We are trying to insert a Marketo form into a Salesforce Partner Community page. The Marketo form works just fine on a Marketo landing page. When we embed it into the salesforce page it doesn't show up. I am wondering if it is being blocked by this Salesforce security release... Release Notes

I would assume this is the case however hopefully someone might have a workaround or an idea on how to get this to work. We would like to have a form that will create leads in Marketo from this Salesforce page.

Any help is much appreciated!

Thanks,

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Marketo form in Salesforce Partner Community

The chance of getting access to all Forms 2.0 functionality with LockerService on, even when using a custom-compiled Marketo forms library, is basically nil.

As much as I champion Marketo forms, they're ultimately a square peg in this context. I would recommend using Lightning native components to build your form, then posting data to the forms endpoint (which is already in your trusted remote sites).

View solution in original post

16 REPLIES 16
Grégoire_Miche2
Level 10

Re: Marketo form in Salesforce Partner Community

Hi Andy,

A Marketo form is a Javascript in the first place. They originate from a Marketo server that you will have to declare as a trusted remote site in SFDC (setup -> security controls -> remote site settings).

Let's say your Marketo LP domain is info.mydomain.com. You will have to add http://info.mydomain.com as a trusted site in SFDC.

You als will have to pay attention to the fact that, by default, the forms2.0 api is called from a Marketo server in an embedded form:

<script src="//pod.marketo.com/js/forms2/js/forms2.min.js"></script>

<form id="mktoForm_9999"></form>

<script>MktoForms2.loadForm("//pod.marketo.com", "000-XXX-000", 9999);</script>

You may want to replace "pod.marketo.com" with your own LP subdomain in the scripts. Or you will have to declare http://pod.marketo.com as a trusted site in SFDC.

-Greg

Anonymous
Not applicable

Re: Marketo form in Salesforce Partner Community

Hi Greg,

Thank you for your reply. I have tried what you suggested and added our marketo custom domain as a remote site in Salesforce and we are still not able to see the form. I also double checked the form embed script and it is populated with our marketo custom domain. If we disable the "Lightening LockerService Security" feature in Salesforce the forms shows up fine. The problem is in a couple months that feature will be enabled by default in Salesforce. Do you have any other thoughts or anything else that I might be able to try? I truly appreciate your help!

Thanks,

- Andy

SanfordWhiteman
Level 10 - Community Moderator

Re: Marketo form in Salesforce Partner Community

The chance of getting access to all Forms 2.0 functionality with LockerService on, even when using a custom-compiled Marketo forms library, is basically nil.

As much as I champion Marketo forms, they're ultimately a square peg in this context. I would recommend using Lightning native components to build your form, then posting data to the forms endpoint (which is already in your trusted remote sites).

Anonymous
Not applicable

Re: Marketo form in Salesforce Partner Community

Thanks Sanford for your reply. I have came to the same conclusion.

Thanks,

- Andy

Luis_Florez1
Level 1

Re: Marketo form in Salesforce Partner Community

Hello,

I have the exact issue as described here, now I am wondering how can I trigger a form submission with a standard html form. I don't see any REST API endpoint that would replace that. In addition, the way we have our Marketo programs is to identify the URL where the form is, so how would it work with that? Is there any example with plain HTML/JS as an example?

SanfordWhiteman
Level 10 - Community Moderator

Re: Marketo form in Salesforce Partner Community

Search my old posts for "/save2".

Luis_Florez1
Level 1

Re: Marketo form in Salesforce Partner Community

Screen Shot 2019-12-13 at 9.46.54 AM.pngThank you. However my SmartList is not capturing any Leads. I am wondering if maybe it has to do with the referrer, since we have the Trigger in the Smart List to Any Form with constrain referrer contains part of the URL that has the form.

In my Community Page I have:

let params = [
'formid=1131',
'formVid=1131',
'munchkinId=XXX-XXX-XXX',
'FirstName=' + this.userRecord.data.fields.FirstName.value,
'LastName=' + this.userRecord.data.fields.LastName.value,
'Email=' + this.userRecord.data.fields.Email.value
];
fetch('https://XXX-XXXX.marketo.com/index.php/leadCapture/save2',
{
method: 'POST',
body: params.join('&'),
headers:{
'content-type': 'application/x-www-form-urlencoded'
},
referrer: document.location.href
}).then(result => {
console.log('result from registration');
console.log(result);
});‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

I receive a 200 response from /save2 with the request attached in a screenshot.

Any idea why I am not collecting any leads?

Screen Shot 2019-12-13 at 9.42.03 AM.png

SanfordWhiteman
Level 10 - Community Moderator

Re: Marketo form in Salesforce Partner Community

Can you highlight your code as JS using the syntax highlighter?

Then I have an answer for you.

Luis_Florez1
Level 1

Re: Marketo form in Salesforce Partner Community

Ok, let's see your answer.