SOLVED

Velocity: Programming custom list data

Go to solution
Travis_Schwartz
Level 4

Please let me know if what I'm wanting to do is possible.

 

I have a custom list that comes over every day and I have the following fields coming over

Date1: this gives the date that the person was added to the list

List ID: Referring Members

Text3: First name in all caps

 

What I want to do is have a token that converts the first name (Text3) to proper case for those who are on the list with list ID = "Referring Members" with the date in the date field = today.

 

Alternatively, if we can't do the date, just pull the Text3 information from the Custom List ID "Referring Members"

 

 

2 ACCEPTED SOLUTIONS
SanfordWhiteman
Level 10 - Community Moderator

It can't pull information from a custom object?  This feels very limiting.

Velocity absolutely, positively, completely* can pull information from Custom Objects.

 

What’s confusing people is that your Custom Object appears to be called “List” which sends people down a very different road, since they’re thinking about Static or Smart Lists.

 

So let’s rename your Custom Object to something else: “Party Balloon Rental”.

 

Your Party Balloon Rental CO has 2 fields:

  • Rental ID
  • Text3

 

So you want iterate over the list of Party Balloon Rentals to output the value of Text3 when the Rental ID is “Roy-Wambsgans-1234”.

#if( !$PartyBalloonRentals__cList.isEmpty() )
#foreach( $rental in $PartyBalloonRentals__cList )
#if( $rental.RentalID.equals("Roy-Wambsgans-1234") )
${rental.Text3}
#break
#end
#end
#end

 

 

 

 

 

 

 

* Well, 1st-level objects, at least.

View solution in original post

SanfordWhiteman
Level 10 - Community Moderator

This won’t work, you need to set the displayable item inside the loop.

 

#if( !$customList__cList.isEmpty() )
#foreach( $rental in $customList__cList )
#if( $rental.listID.equals("Referred Members") && !$rental.Text3.isEmpty() )
#set( $reCased = $rental.Text3.substring(0,1).toUpperCase() + $rental.Text3.substring(1).toLowerCase() )
#break
#end
#end
#end
${reCased}

 

 

You can rename the loop variable $rental to anything you want. $customList for example.

View solution in original post

17 REPLIES 17