This topic contains 10 replies, has 0 voices, and was last updated by cgieselman 8 years, 10 months ago.
-
AuthorPosts
-
January 11, 2016 at 12:54 am #2933
GAJAppreciate help on what the syntax would be to reference the original QUOTE # that created the Sales Order, from within the Invoice template.
This is a cached copy. Click here to see the original post. -
January 11, 2016 at 3:53 am #2934
ALAGARSAMYHi Gaj,
If you are using normal PDF Layout add a custom element text as {createdfrom.createdfrom} in the Invoice PDF Layout.
-
January 11, 2016 at 9:16 pm #2935
GAJThank you Alagarsamy, works perfectly:
From an Invoice PDF/HTML Template,
${record.createdfrom.createdfrom} returns
Quote #FR-124641
Can you also describe the NS syntax to LTRIM the “Quote #” string off the front?
Would it be best done here in the template or in a Custom Transaction Body Field’s DEFAULT VALUE / Formula?
Sorry I have to ask, can’t find working syntax examples and am on limited trial-and-error time.
Gary
-
January 11, 2016 at 10:12 pm #2936
michoelTry:
Code:
${record.createdfrom.createdfrom?replace(‘Quote #’,”)} The documentation for the templating engine that NetSuite uses for generating Advanced PDF/HTML documents is available here:
-
January 12, 2016 at 2:19 am #2937
GAJThanks Michoel, it too worked perfectly:
Code:
${record.createdfrom.createdfrom?replace(‘Quote #’,”)} Still, I need one more piece of syntax advice… turns out, since we are in a multi-language environment, English & French, the quote labels returned vary, e.g.
Quote #FR-124641
Devis #FR-124641
What would syntax would you then use to return everything AFTER the # sign?
Very much appreciate your time on this.
Gary
-
January 12, 2016 at 3:21 pm #2938
michoelYou could do:
Code:
${record.createdfrom.createdfrom?replace(‘Quote #’,”)?replace(‘Devis #’, ”)} Or using a regular expression, this might be cleaner (untested):
Code:
${record.createdfrom.createdfrom?replace(‘^.+ #’, ”, ‘r’)} -
January 15, 2016 at 11:21 am #2939
cgieselmanWithout meaning to hijack this thread, I’m trying to get the original order date to print on an invoice template. I can get
Code:
${record.createdfrom.trandate} to return the date but it is in the format “YYYY/MM/DD hh:mm:ss” but the time value is all 0’s.
I’ve tried
Code:
${record.createdfrom.trandate?date(‘mm/dd/yyyy’) but I can’t save the template, I get the error “The string doesn’t match the expected date/time format. The string to parse was: “”. The expected format was: “mm/dd/yyyy”.”
I can get rid of the time using the replace method above but that still leaves me with a date format that doesn’t match others on the sheet or what most of our customers are used to.
Any help is appreciated.
-
January 17, 2016 at 3:37 pm #2940
michoelThe ‘date’ builtin actually does the opposite of what you are trying (converts a string to date, not date to string)
Try:
Code:
${record.createdfrom.trandate?string(‘mm/dd/yyyy’) You can also set this globally for the template:
Code:
-
January 18, 2016 at 6:16 am #2941
cgieselmanOriginally posted by michoel
View Post
The ‘date’ builtin actually does the opposite of what you are trying (converts a string to date, not date to string)
Try:
Code:
${record.createdfrom.trandate?string(‘mm/dd/yyyy’) You can also set this globally for the template:
Code:
Michoel – I tried making the first suggested change and on save it gave me the error
“Expected method. record.createdfrom.trandate?string evaluated instead to freemarker.template.SimpleScalar on line 207, column 50 in template.”
I tried it with and without the ending “}” that I think is missing from your line but it didn’t like it either way (without the bracket it gave a different error complaining about the missing bracket).
I’m not sure where the second line should go but I tried it within the tags as well as within the tags and it didn’t like either, giving the error
“Parse exception during template merging freemarker.core.ParseException: Token manager error: freemarker.core.TokenMgrError: Unknown directive: #setting on line: 177, column: 441, in template: template in template”
Any thoughts? Thanks for your help.
-
January 18, 2016 at 4:48 pm #2942
michoelHmm, seems like the ‘createdfrom.trandate’ field is actually a string, so you do want the ‘?date’ builtin to convert it to date. Though your mistake was trying to put the date format you wanted to output, while ?date requires the date format of the input string. The following should work:
Code:
${record.createdfrom.trandate?date(‘yyyy-mm-dd hh:mm:ss’)}
I am not sure why the date_format setting is not working for you. It works fine when I try.. -
January 19, 2016 at 6:23 am #2943
cgieselmanOkay so I’ve made progress and it will work for my needs but now I’m curious why it is acting the way it is.
I tried changing the ?date to specify the correct input format as you suggested but it resulted in the same error as I got above. Then I encapsulated the field value in an bracket to check if the length of the string ${record.createdfrom.trandate} was >0 and this allowed me to save and get the results I wanted on a test invoice.
It seems to me that NetSuite is trying to validate every field on save and because it is returning null with regards to the created from transaction date and it is bricking. Would this behavior make sense to you?
Anyways, thanks for the help.
-
AuthorPosts
You must be logged in to reply to this topic.