I'm looking to have a button create a pdf from a...
# suitescript
s
I'm looking to have a button create a pdf from a bill with adding some other info, i would assume I should use the render method?
c
You use a suitelet and render the pdf that way
button click -> launch suitelet -> display pdf
You use N/render if you want to render the special pdf though
s
what is the benefit of suitelet , or a button firing a script?
b
N/render does not work clientside
s
well that answers it
@battk I wish i could search history in this slack, you once gave me a bunch of info on render and free maker
I'm looking for more info on creating a suitelet and redning pdf , the docs are very confuzing
b
the two techniques you need to combine are rendering a pdf file and making a suitelet return a file
if you dont know either, i recommend starting at making a suitelet that returns a file (any file)
then making the button that opens a window to the suitelet
after you get that working and you confirm that its what you want, then you can move onto generating the file
s
@battk good advice
im stuck at making the button open the suitelite
b
s
lol my button is user event script
b
your button's function runs client side
s
the button function can be inside the userevent script or should be a 3rd file
b
i would recommend a client script file
s
so 3 files 1.button 2.client script function to launch the sutielet 3.suitelet
b
yes
you can combine the button with the client script if you make a form level client script
s
i thought for view mode button you use userevent script
b
if you are determined and know how eval works, you can skip the client script and generate a string representing your code for the functionName
s
got it
is it bad practice to hard code the full url inside a user event script ?
b
s
im onto the next step generating the pdf , thias is the area iI am very lost in
b
do you have a working template?
s
nope
b
thats where you would want to start
i recommend customizing the existing one until it looks like what you want
s
how do i pass in the id of the record to the suitelet ,
Copy code
var firesrc = `(id)=> {
var output = url.resolveScript({
    scriptId: 'customscript825',
    deploymentId: 'customdeploy1',
    returnExternalUrl: true


})window.open( output, "_blank")

}`;
i guess plain old js is the way
b
You probably dont want to use the external url of your suitelet
Thats basically a public url
s
yeah i siwrched that
b
Use the params parameter of url.resolveScript for your url parameters
s
lol i just added to the ind but that is smarter