Hi Everyone, I have a suitelet which shows some sa...
# general
n
Hi Everyone, I have a suitelet which shows some saved searches in it and I want to show that suitelet on a portlet. Can you please let me know how to do that??? Thanks !
b
use an iframe
n
I want to show that suitelet data on the dashboard, How can I do that using iframe html?
b
you can use an inline html poortlet to display whatever html you want
or you can use a simple form portlet with an inline html field to do something similar
n
@battk, Can you please share me any sample inline html portlet script where suitelet is getting called and data is shown on the portlet?
b
what have you tried?
n
below is the portlet script I have written for calling a suitelet and showing its data:
/**
*@NApiVersion 2.x *@NScriptType Portlet */ define(['N/http','N/url'], function(http,url) { function render(params) { var suiteletUrl = url.resolveScript({ scriptId: 'customscript_sales_rep_report', deploymentId: 'customdeploy_sales_rep_report', returnExternalUrl: true }); var response = http.get({ url: suiteletUrl }); params.portlet.title = 'My Portlet'; var content = '<td><span><b>'+response+'</b></span></td>'; params.portlet.html = content; } return { render: render, }; });
it is giving me error:
b
none of that looks like an iframe
n
I'm using Inline HTML portlet
b
good so far
and how do you plan on showing your suitelet contents
n
I'm very new to this thing! so I really don't know!😅
b
my recommendation is an iframe
learn how they work before using them
n
okay, thanks
b
a basic first stop would be MDN iframe reference
n
but can I show iframe on dashboard?
b
that is what the inline html portlet
it allows you to add html to the dashboard
n
iframe is inline html portlet u mean?
b
inline html allows you to add additional html elements to the page
n
it means I need to add the iframe code for a inline html portlet?
b
not truly understanding the terms you are using here
again, inline html portlet allows you to add html to your dashboard
n
yah right
can you please give me study link of inline html portlet?
b
achieved via a string that you set via Portlet.html
the string can be whatever html element you want, including an iframe
i suspect you already found the primary help for inline html portlets at Inline HTML Portlet Script Sample
n
yah, right!
b
keep in mind you should have a basic understanding of html to do this
n
yah I have but the error I'm getting is something else!
which I have shown you above
b
the error is saying that suiteletUrl is not a full url
its only the path part of the url
n
yah, I have added full url with http// even though it is giving me that error
b
whats the url of your suitelet
n
please check this code: /** *@NApiVersion 2.x *@NScriptType Portlet */ define(['N/http','N/url'], function(http,url) { function render(params) { /* var suiteletUrl = url.resolveScript({ scriptId: 'customscript_sales_rep_report', deploymentId: 'customdeploy_sales_rep_report', returnExternalUrl: true }); */ var response = http.get({ url: 'https://5454552-sb1.app.netsuite.com/app/site/hosting/scriptlet.nl?script=770&amp;deploy=1' }); params.portlet.title = 'My Portlet'; var content = '<td><span><b>'+response+'</b></span></td>'; params.portlet.html = content; } return { render: render, }; });
b
that should give you a different error
probably something about your url not using http
use N/https for https, N/http for http
n
I have used : /** *@NApiVersion 2.x *@NScriptType Portlet */ define(['N/https','N/url'], function(https,url) { function render(params) { /* var suiteletUrl = url.resolveScript({ scriptId: 'customscript_sales_rep_report', deploymentId: 'customdeploy_sales_rep_report', returnExternalUrl: true }); */ var response = https.get({ url: 'https://5454552-sb1.app.netsuite.com/app/site/hosting/scriptlet.nl?script=770&amp;deploy=1' }); params.portlet.title = 'My Portlet'; var content = '<td><span><b>'+response+'</b></span></td>'; params.portlet.html = content; } return { render: render, }; });
https now
which is showing : http.ClientResponse on the portlet
b
sounds reasonable
im going to tell you that the conclusion to this chain is a invalid solution
n
but it is not showing the data of suitelet?
invalid solution??
b
there are multiple things wrong with what you are trying to do
solving each of them still wont get you what you want
at least not easily
n
ohh!!, I'm totally new to portlet thing!!!
b
its not even a portlet thing
even if you managed to do the get correctly, you now have an entire html document
n
I didn't get you
b
you cant stick an entire html document in another html document
n
so, what is your advice here?
b
learn how iframes work
n
okay, cool thanks I'll do that!
b
use what you learned to generate the source of an iframe
set your portlet.html to that iframe string
n
how can I create an iframe in Netsuite?
I know I'm asking too much!😅
b
the same way you add any other html to netsuite
using things like inline html fields
those types of field allow you to add html to the netsuite page
if you dont know how to write html, you probably want to learn html before trying to learn iframes
n
sure, thank a lot!