Skip to main content
Level 5
October 8, 2026
Question

Marketo Segmentation Not Working in Velocity Scripting

  • October 8, 2026
  • 1 reply
  • 15 views

Hi Team,

We have a segmentation in Marketo that was working correctly during our initial testing, but it is now not working as expected. We have not made any changes to the segmentation.

The same segmentation is also causing an issue when used in another campaign. The email is always going to the else condition, and the if condition is not triggering.

I tested other segmentations, and they are working as expected. This particular segmentation is used through a Velocity Script , which was previously tested and worked correctly.

I also tried unapproving and reapproving the segmentation, but this did not resolve the issue.

#set( $portalsegment = ${lead.Segmentation_CustomerPortalSegment_1018} )
#set ($ContactId = ${lead.contactid})
#if( $portalsegment && $portalsegment.trim() == "Portal Status Is Active" )
DISPLAY A
#else
DISPLAY B
#end


Let me know if you need more details , happy to share :)

Looking forward to your help on this !!

Regards,
Akshat

1 reply

sandy_logitech
User Group Leader
User Group Leader
October 8, 2026

Please insert code using the syntax highlighter in the future so it’s readable.

 

  1. You don’t need any curly braces in this code. It’s just making it less readable.
  2. You don’t need the falsiness check (if $portalsegment). It’s impossible for the value to be non-falsy.
  3. You don’t need to trim(). Marketo uses the real name of each Segment, it doesn’t pad the name.
  4. You shouldn’t use ==, use .equals().
  5. What is the value of $portalsegment here. You have to show us lower-level debugging info or we have nothing to go on.