AnsweredAssumed Answered

Velocity script on Custom Object

Question asked by Kacper Gawlik on Aug 9, 2019
Latest reply on Aug 12, 2019 by Sanford Whiteman

Hello!

I was looking for this within the forum but could not find ideal solution for my issue.

I am using following script on pulling out particualr content however, I wanted to show default content when contact is not in my CO

 

#foreach($content in $nurture_COList)
#set($url = $content.url)
#set($urlLength = $url.length() - 0) ## gets the length of the url
#set($trimUrl = $url.substring(8,$urlLength)) ## takes the sub-string starting after https://
<p><strong><a href="https://${trimUrl}">${content.title}</a></strong><br />
</p>
#end

$content is a field that is pushed by the external provider that pushed data into it.

There is also MarketoId field to which I want to refer when it's empty then load default content i.e.

 

#foreach($content in $nurture_COList)
#set($url = $content.url)
#set($urlLength = $url.length() - 0) ## gets the length of the url
#set($trimUrl = $url.substring(8,$urlLength)) ## takes the sub-string starting after https://
<p><strong><a href="https://${trimUrl}">${content.title}</a></strong><br />
</p>
#if $(nurture_COList.get(0).marketoId.isEmpty())
My Static Value
#end
#end

 

But that does not seem to work.

 

Anyone is able to help me withi this? Appreciate any insight!

 

Thanks,
Kacper

Outcomes