Attention: The Marketo Community will undergo scheduled maintenance on Tuesday, August 20th between 10-11 PM PDT. During this time, the Community and its content will not be accessible. We apologize for any inconvenience this may cause.
I have forms setup on each product page on my website. When someone fills out the form, I receive an email. I want the email to include what product they were looking at. How do I translate the product ID in the URL slug to the associated product ID in my CRM system?
For example, if I fill out a form on the page www.test.com/123, and 123 is known as product 1 in my CRM, I want to receive an email trigger from Marketo that says "New Form filled out for "Product 1."
What you're calling the URL slug is the pathname (or part of the pathname), a standard value available in the browser.
You'd have to use JavaScript to parse that value out of the URL, then write it to a hidden field on the form using addHiddenFields.
A greatly simplified example:
MktoForms2.whenReady(function(form){
form.addHiddenFields({
LastProductPage : document.location.pathname.replace(/^\//,"")
});
});
Also pretty sure this has been asked (and answered by me!) before, if you search.
Hi Stanford,
Thank you for the quick response. The issue is not getting that value, but rather translating it from a code to the product name in our CRM system. Is this something we can do without getting into the website code? We only have access to the forms form the Marketo side.
Thank you!
Actually you do need JS like the above to get the code, or you'll have nothing to look up on the server side!
The translation from the code to the friendlier name can be done in one of 2 ways:
Obviously if you have no way of looking up the product names, whether via API or a periodic export/paste, there wouldn't be any way to accomplish this... Marketo can't read from the private db used on your site.