Hi Team, Has anyone used the render HTML in suitel...
# suitescript
s
Hi Team, Has anyone used the render HTML in suitelt page in 2.0?
j
Are you talking about rendering HTML to a suitelet response? Or a specific method in a module.
s
Yeah @jarens
j
Sample
Copy code
/**
 * @NApiVersion 2.0
 * @NScriptType suitelet
 */
define(['N/ui/serverWidget'], function(sw){
    var exports = {onRequest: onRequest};
    function onRequest(context){
        var myHTML = '<h1>Hello World</h1>';
        
        var form = serverWidget.createForm({
            title: 'Hidden',
            hideNavBar: true
        });
        form.addField({
            id: 'custpage_header',
            type: sw.FieldType.INLINEHTML,
            label: ' '
        }).updateLayoutType({
            layoutType: sw.FieldLayoutType.OUTSIDEABOVE
        }).updateBreakType({
            breakType: sw.FieldBreakType.STARTROW
        }).defaultValue = myHTML;

        context.response.writePage(form);
    }
    return exports;
});
s
No I meant is there way I can pass some value from suitelet to html ?
not by loading it
j
I would imagine in your HTML you would just add some javascript to do a fetch to the suitelet and get your response.
s
I usually do that.. But I believe we can render the data from suitelet directly