Hi all. I'm trying to fix a problem with a suitele...
# suitescript
j
Hi all. I'm trying to fix a problem with a suitelet that just cropped up. I have a "print sales order" suitelet that get fired off when hitting a custom button on a sales order. The suitelet will pull specific fields from the sales order and set them in an html template. Currently, the template has a hard coded line to display an image - <img class="logo" src="

https://www.resourcefurniture.com/netsuite/rflogo.jpg

"/> . We just recently upgraded our website to a new platform and this image no longer exists. I have tried to use an image in my file cabinet, but it always causes and error. This is my preference, The code i used in my template for this image was - <img class="logo" src="https://XXXXXXX.app.netsuite.com/core/media/media.nl?id=1235372&amp;c=3430294&amp;h=NBsfWVMh3C6rceQY_qSAZP6nGGycUtrNMYSUN4maGHHZFABn"/> , but always causes an error. if possible, I would like to use an image from the file cabinet. Any thoughts? Thanks!
m
Are you getting the error when you try to save the template, or when you view the resulting PDF? What's the error? In the file cabinet, is the "Available without Login" box checked for the image?
j
@Zoran R-DATAGRAM thanks for your response, but i'm not quite sure i understand your answer, or how it would fix the problem.
@Mike Robbins HI Mike, thanks for your answer. the "template" is simply an html file that gets loaded by the suitelet, so it's not your normal PDF Template from the forms area. I don't know what the error is, but it gets "caught" from the "try{ }" section of code, into the "catch (ex) { }" section. I haven't done a lot with suitelets, so hopefully i'm making sense. Yes, the image is available without login.
m
So in that
catch
area, you should be getting or logging the exception that was thrown. What is that error message? If you don't have it already, you can log
ex.message
inside that catch and it should show up in the script log.
j
@Mike Robbins I'll give that a shot. i've been in fireman mode today. thanks.
z
oh my god, sorry... wrong thread, I deleted my post... sorry once again
j
@Zoran R-DATAGRAM LMAO... No worries!
@Mike Robbins Hey Mike, i just wanted to get back to you. The error that was being thrown was complaining about the Ampersands in the image URL. So it turns out that it is a problem with the ampersand symbols in the NetSuite path to the new logo that i wanted to host in NS. The "standard" preprocessing that occurs in NS templates allows you to substitute "&:" for "&" and that works fine. The problem is that all of my client facing PDF's are being created from a suitelet that pulls in an html template file and then renders the pdf via the render API. This render API does not support the "&:" substitution or any other escaping that i tried. It's a known bug. I finally gave up and now the new logo is hosted on the new shopify website. A few days of grief I will never get back!