How to get the value of the template from the custom transaction form?
Loading a custom transaction form record using
let r = record.load({ type: 'custform', id: 178 }) and trying to get the 'Print Template' value.
r.getValue('advformlayout') returns null.
The value exists though. Any ideas?
c
creece
12/12/2023, 5:20 PM
What is the use case here for getting the template ID? What are you trying to accomplish w/ the template ID? A little more info will be helpful to figure out an approach.
d
Dan P
12/12/2023, 5:23 PM
@creece Rendering the record as a PDF using TemplateRenderer.setTemplateById with the render.create method. I was hoping the custom form Id 178 would be enough but it needs the template ID 129 instead so I'm trying to load the template ID from the custom form
c
creece
12/12/2023, 5:30 PM
Do you have multiple PDFs that should be printed based on the form or will it always print the same PDF?
creece
12/12/2023, 5:31 PM
If its the same PDF, i'd make a script parameter that stores the template ID and then have your script read that template ID and use it.
d
Dan P
12/12/2023, 5:33 PM
multiple. That is why I'm trying to make it dynamic.
c
creece
12/12/2023, 5:44 PM
Doesn't seem like you have access to forms for scripting so you can't get to the ID. You could make the form itself dynamic but not sure how much customization you have in it. Then you can specify the template ID as a parameter and let freemarker do the dynamic part.
d
Dan P
12/12/2023, 5:52 PM
Yes, it looks that way. Just more NS inconsistencies and frustrations 😡 I appreciate your input.