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

Benjinc
Level 2

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

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

 

 

3 REPLIES 3
Jo_Pitts1
Level 10 - Community Advisor

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

@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?

Benjinc
Level 2

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

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 - Community Moderator

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

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.)