Good afternoon,
Our Marketo instance is synced to Salesforce which has been configured to retrieve two Custom Salesforce objects, Product Preferences and Company Product. The latter is a parent of the former linked by a Product ID field.
The objects are available in Marketo as filters and triggers and can also be viewed and referenced in a Email Scripting Token to create dynamic content blocks for emails.
The objects however do not contain details relating to their specific website page, the URLs for which are available externally to Salesforce.
These URLs have been imported into a Marketo Custom Object (Product URLs) that is not directly related to a Person record in the set up of the Custom Object.
In terms of relationships, a person can have multiple Product Preferences and each of these Product Preferences, is linked to a record in the Company Product object and in turn, should also have a specific webpage URL available in the Marketo Custom Product URLs object.
I've attempted to loop through the Product Preferences SFDC object in a script, which incidentally has been tested and does work, but have extended the script to then loop through the Product URLs Marketo object (productPermalink) and where the Product ID values achieve a match, pull the URL value into the HTML copy.
#set( $counter = 0 ) ## Initialize a counter
#foreach( $fund in $Product_Preference__cList )
#set( $productID = $fund.Product__cList.get(0).Product_ID__c )
#foreach( $productPermalink in $productPermalink_c )
#if( $productPermalink.productID == $productID )
#if( $counter < 5 ) ## Check if the counter is less than 5
//HTML copy inserted here, e.g. <a href="$productPermalink.permalink" target="_blank">
#set( $counter = $counter + 1 ) ## Increment the counter
#else
#break ## Stop the loop when 5 product preferences have been displayed
#end
#end
#end
#end
However, I cannot get this to work and am wondering whether conceptually this is even possible.
If this is possible in theory, then I think there may be an issue with my object and field references and need to understand how I might retrieve object API names, including the correct __cList suffixes, and script and test the references correctly.
If the approach is flawed however, are there any suggestions of how this might be achieved. It may be a case that it is more efficient to extend the SFDC custom object to include the URL field but I would like to understand whether I could achieve the desired result through Marketo instead.
Any advice would be greatly appreciated.
Regards