https://netsuiteprofessionals.com logo
b

Brian Brown

04/25/2022, 2:34 PM
Anyone have good recommendations on how to create a ZPL file within SuiteScript?
a

Azi

04/25/2022, 2:39 PM
You can just have a function that returns a string of your zpl based off your parameters. I have done it before. Pretty straghtforward. Do you have any unique requirements?
b

Brian Brown

04/25/2022, 2:40 PM
Hey thanks for your input @Azi. As I understand SuiteScript can only create certain file types.... TXT, CSV, PDF, etc
Is it possible to have a SuiteScript use file.create to create a ZPL file?
a

Azi

04/25/2022, 2:41 PM
So I don't know exactly how you plan on using that, but you can just create a text file with an extension of
.zpl
b

Brian Brown

04/25/2022, 2:44 PM
ahhh ok then!
We need to create the ZPL file, then save it in the FILE CABINET. For use later.
But, of course, the ZPL file must be able to be used with the Zebra printer.
So it is possible with file.create to set the file extension to ".ZPL" ?
a

Azi

04/25/2022, 2:45 PM
I don't thinks so
b

Brian Brown

04/25/2022, 2:46 PM
Oh I thought that's what you were saying earlier.
"just create a text file with an extension of
.zpl"
So you've never used file.create to create a ZPL file before?
a

Azi

04/25/2022, 2:48 PM
Sorry. Yes. I misunderstood your last question.
So it is possible with file.create to set the file extension to ".ZPL" ?
Yes. Should should be able to create a plain text file and just name it myfile.zpl
b

Brian Brown

04/25/2022, 2:48 PM
Ok ok then good news there.
Let me give it a try then!
a

Azi

04/25/2022, 2:48 PM
I could be wrong
a

alien4u

04/25/2022, 2:49 PM
ZPL is just a text file, nothing else.
b

Brian Brown

04/25/2022, 2:49 PM
Hey @alien4u thx for the input.
I suppose for an actual Zebra printer to actually print the file though. It must have a .ZPL extension.
I don't think Zebra printers will take .TXT files.
a

Azi

04/25/2022, 2:50 PM
@alien4u Correct, but will file.create automatically add a file extension?
b

Brian Brown

04/25/2022, 2:50 PM
So trying to determine how to create that .ZPL file fully and wholly within Suitescript.
a

alien4u

04/25/2022, 2:50 PM
You should be able to create a file with any extension you want...
a

Azi

04/25/2022, 2:50 PM
That's what I thought
b

Brian Brown

04/25/2022, 2:50 PM
Ahhh... I was under the understanding that file.create can only create files with certain extensions.... TXT, CSV, PDF etc
Maybe there is a way to have file.create create a .ZPL file then??
a

alien4u

04/25/2022, 2:52 PM
@Brian Brown File create defines the file type but you can set whatever name you want, including the extension.
☝🏿 1
b

Brian Brown

04/25/2022, 2:53 PM
Ahhh ok ok then! We're not limited to a certain set of defined file extensions then?
good news there... and that's mostly what I was trying to understand here
Thx guys, I think that makes sense.
Next, to find a library function to create ZPL text content! lol 😄
a

alien4u

04/25/2022, 2:55 PM
@Brian Brown No library that I'm aware of, you need to create the ZPL content yourself, I used this back in the day when I was creating stuff for Zebra Printers
b

Brian Brown

04/25/2022, 2:55 PM
Thank you @alien4u. Great tool here!
Thanks guys, I owe you one!
a

Azi

04/25/2022, 2:56 PM
With template literals available in 2.1 its very easy to do yourself once you generate the what you want the label to look like in labelary
2 Views