No success trying to use a Member Program field in Velocity Script | Community
Skip to main content
Level 2
October 4, 2024
Question

No success trying to use a Member Program field in Velocity Script

  • October 4, 2024
  • 2 replies
  • 1176 views

I am having trouble producing a script to reference a program member value.

 

The below works fine when I use a standard Lead field, so assume my script is OK but my exact language in referring to the program member object is wrong.

Is there something obvious at fault below?

Is there any documentation that details how to call different objects from different places?

 

 

#set( $size = $programMember.get("hRSVFAddressCity") ) #if( $size.toLowerCase().contains("u1000") ) ## Display your custom content for u1000 U1000 content #end

 

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

Jo_Pitts1
Community Advisor
Community Advisor
October 4, 2024

@benjinc ,

From memory, try  $member.<<fieldName>>

 

so something like 

#set( $size = $member.hRSVFAddressCity )

 

If you drag a field from the tree on the right into the Velocity editor, it shows you how it's referenced, albeit for display purposes (and for COs the first (zero-th) entity).

 

Cheers

Jo

BTW - setting a variable called size, for something that has the word City in the program?  Seems a tad unintuitive?

BenjincAuthor
Level 2
October 4, 2024

Thanks both, will give that a shot and report back,

Re the city thing, I sadly created a load of member parameters before I realized there was a limited number available and theyre undeletable.

I have therefore had to repurpose a load, so that is actually called 'Program member string 1' but sadly still has the old API name!

SanfordWhiteman
Level 10
October 4, 2024
Also to be clear, you must check the field off in the tree. Otherwise you will not be able to use it, regardless of whether you know its Velocity API name.

(This is why you should always comment every Velocity token with the friendly names of the referenced fields, because copying the code alone into another program will not copy the references.)