Hi All, i want to print custom pdf template in cus...
# advancedpdf
Hi All, i want to print custom pdf template in customer's locale via script. Is it possible? I am using render.create() api to set template id and record but there is no parameter for custLocale. Please help. Thank you
We found a solution to do exactly what you are trying to do. We had to create a custom free-form text field called Customer Locale, with the following formula:
COALESCE({entity.language.id}, 'en_US')
(substituting your preferred default locale as the second argument), then in the PDF template, we put this at the very top:
<#assign locale = record.custbody_customer_locale>
<#setting locale = locale>
If you are using translation collections in your template, then set the locales as follows:
nstranslation.load({ 'locales': [ locale ], 'collections': [{ … }] })
Basically, the template is loading the customer locale setting via a formula field, then setting the locale manually.