Saturday, June 15, 2019

Add an Image to a Suitelet Form

To add an Image to a suitelet form, you can add a field of type inline html. You can then use the "<img>" tags to add your image. Below is a sample suitelet script that displays an image.

function suitelet(request, response){

 var form = nlapiCreateForm('Form with Image');

 form.addField('custpage_image','inlinehtml','image');

 // add the url of the image
 var img = "
https://system.na1.netsuite.com/core/media/media.nl?id=4&c=TSTDRV1111111=dc3656a2490976013166"; // Use the url in file cabinet

 var image_tag = '<img src="'+img+'"/>';

 form.setFieldValues({custpage_image:image_tag});

 response.writePage(form);
}

No comments:

Post a Comment