Weirdness using sorter.sort for custom object list.
I have a velocity script as follows:
#set ($rawList = $CstPolicyList)
#set ($sortedList = $sorter.sort($rawList,"policySaleDate:desc"))
Here is Sorted List:
#if($sortedList.size() > 0)
<table>
<tr><th>ID</th><th>Sale Date</th></th></tr>
#foreach($policy in $sortedList)
<tr>
<td> $policy.policyId</td>
<td>$!policy.policySaleDate </td>
</tr>
#end
</table>
#else
Sorted list is empty! <br>
#end
---------
Here is Raw List:
#if($rawList.size() > 0)
<table>
<tr><th>ID</th><th>Sale Date</th></th></tr>
#foreach($policy in $rawList)
<tr>
<td> $policy.policyId</td>
<td>$!policy.policySaleDate </td>
</tr>
#end
</table>
#end
policySaleDate is a Marketo Date field. It may be empty.
When I run it, I get output for the second, "rawList". But nothing for the sorted list (size is 0).
Even weirder, if I change the sort column to use updatedAt:
$sorter.sort($rawList,"updatedAt:desc"))
Or to
$sorter.sort($rawList,"updatedAt:asc"))
$sorter.sort($rawList,"updatedAt:desc"))
Then I get Identical output for both the sortedList and the rawList. The "asc" and "desc" do not make a difference.
Why would the sort not return anything if I reference the "policySaleDate" field? I know it is the correct name (and I have the check box checked in the list)
because the data shows up in the email for the $rawList
Message was edited by: Digital Pi fixed some typos