velocity script is rendering a random time, idky. | Community
Skip to main content
New Participant
August 12, 2022
Question

velocity script is rendering a random time, idky.

  • August 12, 2022
  • 2 replies
  • 2575 views

Probably not the right Location for this but i'm trying to pull in a SFDC custom object formula field and it's spitting out a random time.

Script is pulling in everything right except the time. Anyone know why time is being weird?

#set ($sadate = 'not available') #foreach($project in $project_task__cList) #if( $project.Service_Type__c.toLowerCase().equals("randomness") || $project.Name.toLowerCase().equals("random")) #set ( $sadate = $convert.parseDate($project.Service_Appointment_Start_Time__c, 'MM-dd-yy HH:mm') ) #end #end $sadate

 

should be Thu Jun 08 3:00 pm HST

 

is showing 

Thu Jun 08 14:00:00 CDT 2180

 

 

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

2 replies

New Participant
August 15, 2022

Heard.

 

$convert.parseDate($task.Service_Appointment_Start_Time__c, 'yyyy-MM-dd')) #set ($sadate = 'not available') #foreach($task in $TASKRAY__Project_Task__cList) #if( $task.Service_Type__c.toLowerCase().equals("installation") || $task.Name.toLowerCase().equals("install")) #set ( $sadate = $convert.parseDate($task.Service_Appointment_Start_Time__c, 'MM-dd-yy HH:mm') ) #end #end $sadate
SanfordWhiteman
New Participant
August 15, 2022

That’s not output. It’s your code.

 

Again, you have not provided the raw values of the data you’re trying to parse. Like saying “Why doesn’t my string parse into a date using the format ‘yyyy-dd-MM ss:HH’?” without providing the value of the string.

 

Provide the output of the single line:

${TASKRAY__Project_Task__cList}

 

New Participant
August 15, 2022

Is the output not what i put in the original post:

"

should be Thu Jun 08 3:00 pm HST

 

is showing 

Thu Jun 08 14:00:00 CDT 2180 

"

SanfordWhiteman
New Participant
August 12, 2022

Impossible to answer as you haven’t shown the actual values you’re trying to parse. Property names don’t tell us anything about values.

 

You need to dump

$project_task__cList

and show the result.

New Participant
August 14, 2022

@sanfordwhiteman can you elaborate? I thought the the foreach allows you to shorten the name later in the script ie - #foreach($task in $TASKRAY__Project_Task__cList) means that i can use $task instead of the long string later. 

 

The value i'm trying to pull is Service_Appointment_Start_Time__c which I working to get verification is a formula field in SFDC. I've pulled it in a few different ways and was using script i had seen you post before so I'm not sure i understand how to pull the correct value.

SanfordWhiteman
New Participant
August 14, 2022
I mean you have to show the raw output here, on the Community, since there's no way to help you with parsing if you don't show the value you're trying to parse as a date with a particular format.