I need your advise on how to reduce the height and width of an image.

Brian186
Tera Expert

Hello,

We followed the steps in the blow link to add an image to the body of the notification.  

https://www.servicenow.com/community/developer-articles/embedding-image-attachments-in-the-body-of-n...

 

Some of the attached images are cutting off, because the Width and Height are too big

 

We need help on setting the Width = "300" and Height = "200" for all attached image.

 

We have tried the following code, but no luck of getting it to work. 

 

template.print("<img src=/sys_attachment.do?sys_id=", width=300 ,height=200 + gr.getValue('sys_id') + ">");
 
Any suggestions will be appreciated
 
Thank you

 

3 REPLIES 3

Brian186
Tera Expert

Please discard my posting.  I figured it out modifying the width and height.  Thank you

Hello @Brian186 

 

You need to use .setStyle(width, height);

 

Plz Mark my Solution as Accept , if you find it Helpful and Close the Thread, as it is open.

 

Regards,

Samaksh

Thank you for helping @Samaksh Wani 

I have tried your suggestion, but that did not work.  Here is what I used to get it to works:

 
template.print("<img width='300' height='200' src=/sys_attachment.do?sys_id=" + gr.getValue('sys_id') +  ">");