is there a way to dynamically select what advanced...
# suitescript
u
is there a way to dynamically select what advanced PDF print template to use in SuiteScript 2.0 in a print context? for more details, i have a UserEvent script that runs on a print context, and i'd like to be able to select which print template gets used based on what item in a dropdown list was selected. I would much prefer this approach rather than creating a UserEvent button that calls a Suitelet that runs a render module command to generate a PDF as it's much leaner in implementation. a snippet of the code i use:
Copy code
...
function beforeLoad(context) {
      if (context.type != 'print') return;
      let rec = context.newRecord;
      if( rec == null) return;

/*    
      if rec.getValue( fieldId: someDropDownField) == 1
         pdf-template = CUSTTMPL_100
*/

//rest of code where i make fields for the pdf printout goes here
...
would appreciate any input, thanks!
i have since given up and resorted to using the default field that netsuite provides labeled "Custom Form", and tweak the outputs based on that field's value.