Salesforce Pardot Multi Completion Rules

I do pardot implementations amongst my other salesforce stuff, which always seem to involve a number of hacks to bend the Salesforce and Pardot functions to meet the existing behaviours that the client wants.

Now pardot has “completion actions” these are very useful jobs that are performed when a form is submitted, but limited in that they are not conditional, i.e. you cant say “if field X = Y then do W action else do Z action”, Pardot them selves show you a way round this using form field based completion actions.

This is a nice trick and can be used as a base for more complex things, namely running MULTIPLE completion actions, an example of which is shown below

<script type="text/javascript">
var email = encodeURIComponent('%%email{js}%%')
switch('%%CheckBox_1{js}%%')
{
case 'true': document.write('<iframe src="FORM_HANDLER_1_URL?email=' + email + '" height="1px" width="1px" ></iframe>');
break;
case '': document.write('<iframe src="FORM_HANDLER_2_URL?email=' + email + '" height="1px" width="1px" ></iframe>');
break;
};
switch('%%CheckBox_2{js}%%')
{
case 'true': document.write('<iframe src="FORM_HANDLER_3_URL?email=' + email + '" height="1px" width="1px" ></iframe>');
break;
case '': document.write('<iframe src="FORM_HANDLER_4_URL?email=' + email + '" height="1px" width="1px" ></iframe>');
break;
};
</script>

This means that you can run a lot of conditional rules based on the fields in the one form, the most common use I make of this is of a [Custom Email Preference Center Pages](http://help.pardot.com/customer/portal/articles/2125807-creating-custom-email-preference-center-pages) but one where a user can fill in more details than just their email address.
Oh one final note, you will see on the pardot instructions they close their iframes with a “/>” this wont work if you have multiple iframes on one page you need to close of iframes properly with “</iframe>”

Leave a Reply

Your email address will not be published. Required fields are marked *