Can I pass multiple parameters in a button functio...
# suitescript
m
Can I pass multiple parameters in a button function? It’s reading recordType like its a variable rather then a string. recordId works great. Error is ‘itemfulfillment not defined’
Copy code
const recordId = context.newRecord.id;
const recordType = context.newRecord.type
const printButton = form.addButton({
        id: 'custpage_print_button',
        label: 'Print Commercial Invoice',
        functionName: 'printTemplate(' + recordId + ',' + recordType + ')'
})
b
log out your functionName
a
you need to include param double quotes wrappers in the string
'printTemplate("'+ recordId + '","' + recordType + '")'
m
@Anthony OConnor, thats it! Thank you so much for your time
👍 1
m
Using template literals makes it easier to create strings with variables.