Why is production end and start dates not a refere...
# advancedpdf
s
Why is production end and start dates not a reference-able field in the adv template?
startdate
and
enddate
both exist in the XML info of the Work Order Record but you cannot reference it in the adv template
e
Create a custom field on the Work Order that sources those fields, then you can use your custom field on the PDF
👀 1
s
@ericbirdsall Would i need to have a beforeSubmit script pull the values from those existing fields into my custom field or can the UI for creating custom fields handle that?
e
I believe you can just create a custom field that is set to NOT store value and put the default value as {startdate} I would display that field on a Work Order form just to see if its working correctly. If it is, you can hide it and use those created fields in your template
s
Ok thats what i was thinking as well. Thanks!
Weird i can display the custom field i created on the form that references startdate fine but still get an
ERROR: Field "startdate" not found
when printing the PDF.
e
are you using
record.startdate
on the PDF or
record.custbody_whatever_id_you_gave_your_custom_field
?
s
record.custbody_whatever_id_you_gave_your_custom_field
super weird lol
e
Fun. In that case, you may need to do what you originally mentioned- a beforeSubmit script that copies the default fields to your custom fields
🎉 1
🙄 1
@Scruffy any luck with this?
s
Been playing around with formatting the date once i grab the javascript standard date format in my script. Trying to get the format of
MM/DD/YYYY
using
toLocaleDateString("en-US");
but get
November 3, 2021
when printing with debug. Now playing around with moment.js to see if i can get better control on the formatting. Thanks for the follow up haha
Even in the form of
November 3, 2021
the PDF does not print it even when its a string in a free text box
e
^ that's beyond confusing
s
confusing in as what im saying doesnt make sense or the behavior of what is happening doesnt make sense? 😛
e
the behavior lol.
🤣 1
s
In case you were still curious, I found the solution. You have to have the Display Type of the custom fields as Normal and not Hidden. Having the field
Hidden
is different from as the
Show
checkbox when Moving Elements Between Tabs. ADV PDFs cannot reference fields that are Display Type = Hidden but they can reference Normal Fields that have Show = F.
mindblown 1
e
@Scruffy I could see this piece of information saving me a massive headache in the future, thanks for mentioning it