If the one opportunity in the opportunityList has the value, how can we detect the opportunity?
I want to do the following
If the lead has the date data of "Field93__c" in the one of the opportunity in the $OpportunityList, I would like to show 6 month after date of it. And if the lead does not have date data in the any opportunity in the $OpportunityList, I would like to show the text "Contact Customer Support".
(# of the opportunity in the $OpportunityList can be varied based on each lead)
I create the following script
#set( $defaultTimeZone = $date.getTimeZone().getTimeZone("Asia/Tokyo") )
#set( $defaultLocale = $date.getLocale() )
#set( $calNow = $date.getCalendar() )
#set( $ret = $calNow.setTimeZone($defaultTimeZone) )
#set( $calConst = $field.in($calNow) )
#set( $ISO8601DateOnly = "yyyy-MM-dd" )
#set( $ISO8601DateTime = "yyyy-MM-dd'T'HH:mm:ss" )
#set( $JapanDate = "yyyy年MM月dd日")
#set( $ISO8601DateTimeWithSpace = "yyyy-MM-dd HH:mm:ss" )
#set( $ISO8601DateTimeWithMillisUTC = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'" )
#set( $ISO8601DateTimeWithMillisTZ = "yyyy-MM-dd'T'HH:mm:ss.SSSZ" )
#foreach( $opportunity in $OpportunityList )
#set( $sortedUpdated = $sorter.sort($opportunity,"Field93__C"))
#if($sortedUpdated[0].Field93__C && !$sortedUpdated[0].Field93__C.isEmpty())
#set( $inputDate = $convert.toCalendar(
$convert.parseDate(
$sortedUpdated[0].Field93__c,
$ISO8601DateOnly,
$defaultLocale,
$defaultTimeZone
)
))
$inputDate.add($calConst.MONTH,6)
${date.format(
$JapanDate,
$inputDate,
$defaultLocale,
$defaultTimeZone
)}
#else
Contact Customer Support
#end
#end
But it does not work. How should i correct ?