Marty Zigman

Conversations with Marty Zigman

Certified Administrator • ERP • SuiteCloud

Draw External HTML Pages within NetSuite

NetSuite Technical

Tags: ,

Often times when working in NetSuite, we want to draw some HTML from one site into another.  For example, we often display google doc spreadsheets within NetSuite when we want to present table information.

Here is a generic script that can be used either in a Portlet or Suitelet context.  See how you can create script parameters that  drive the way it works.  This script can easily be enhanced to dynamically size correctly according to where the content is displayed.

 





function drawHTMLPage(request, response)
{
	var context = nlapiGetContext();

	if	(context.getExecutionContext() == 'portlet')
		{
		var url = context.getSetting('SCRIPT', 'custscript_portlet_url');
		var title = context.getSetting('SCRIPT', 'custscript_portlet_title');
		var content = '<iframe width=100% height=100% style=height:500px; src=' + url + '></iframe>'

		request.setTitle(title) //really a portlet context
		request.setHtml(content)
		}

	if	(context.getExecutionContext() == 'suitelet')
		{
		var url = context.getSetting('SCRIPT', 'custscript_suitelet_url');
		var title = context.getSetting('SCRIPT', 'custscript_suitelet_title');
		var content = '<iframe width=960px height=100% style="height:640px;" src=' + url + '></iframe>'
		var newForm = nlapiCreateForm('drawHTML');
		var newField = newForm.addField ('content', 'inlinehtml', title);
		newForm.addField('extra', 'inlinehtml', '')
		newForm.setTitle (title);
		newField.setLayoutType('outsidebelow');
		newField.setDefaultValue (content);
		response.writePage( newForm )
		}
}

During your deployment, specify the values for the script parameters. Or, dynamically in code from your custom NetSuite application, drive the script with parameters as needed.

If you are not a NetSuite developer and would like some  help, be sure to contact us so we can set this up in your account.

Marty Zigman LinkedIn

Marty Zigman

Holding three official certifications, Marty is widely recognized as a top NetSuite expert and leads a team of senior professionals at Prolecto Resources, Inc. A former Deloitte & Touche CPA and technology executive with CTO roles, he brings over 35 years of leadership in ERP, CRM, and eCommerce business systems. Contact Marty to engage directly.

BiographyYouTubeLinkedInX (Twitter)

19 thoughts on “Draw External HTML Pages within NetSuite

  1. Is there a way to pass custom values into the parameters that are set in the Portlet deployment? For example I want the url that is passed to this to be “https://www.linkedin.com/search/fpsearch?type=people&keywords=” so I can embed search results based on the contact that is being views. Is that possible?

    Reply
  2. Is there a way to pass custom values into the parameters that are set in the Portlet deployment?

    For example I want the url that is passed to this to be “https://www.linkedin.com/search/fpsearch?type=people&keywords=NETSUITE+CONTACT+FULLNAME” so I can embed search results based on the contact that is being views.

    Is that possible?

    Thanks!

    Reply
  3. Hey Marty,

    My assumption is that a Portlet could be added on drilldown of a specific support case. Once its there wouldn’t I be able to access specific values of that Support Case (like the Contacts name?)

    -Jeff

    Reply
  4. Hey Marty,

    Thanks for the help. I will try that.

    I work at Buzzient and we are building out a Netsuite Social CRM integration similar to what we did for Salesforce, Siebel CRM, CRM On Demand, Zendesk and others. See our click through demo to get an idea of the Social CRM piece we are bringing to Netsuite https://www.buzzient.com/siebel-click-through-demo/ or for a 2 minute overview see how we integrated Facebook engagement into Oracle CRM On Demand https://www.youtube.com/watch?v=d9BLn49D20M

    Would love to discuss with you more in depth what we are doing with Netsuite.

    thanks,
    Jeff

    Reply
  5. Thanks for your post on drawing external HTML pages in Netsuite.

    I had a question about how to use it. You mention it’s a generic script, do we copy and paste it into a portlet script, or is it a Suitelet script that gets called by a portlet script?

    I was looking up the Portlet scripts in help and I only saw two parameters (portlet, column), so I’m guessing this is a suitelet?

    If you could add a bit more clarification on how to use it, that would be great.

    Thanks,

    Robert.

    Reply
  6. Hi Marty,

    Hope you are doing well…!

    Scenario is : User should be able to make changes to Sales Team without editing it.
    For this case i have added custom tab and on this tab using inlinehtml field i am loading Suitelet. In this suitelet i am sourcing Sales team values and trying to edit it but i am not able to do so.
    Same suitelet is working fine when loaded directly through url.
    Requesting you to guide me on this.

    Thanks,
    Avinash.

    Reply
  7. Hi Marty,

    I have implemented your code in form level(client) script but I am getting null request, response so can you please guide me

    Reply
  8. Thanks for all of your extremely helpful posts!

    Do you know of a way to make the inlinehtml content to fill the page? Filling the width is pretty easy with width:100% on inline styles, but filling the height is another story and just wanted to see if you had a solution you could share?

    Suitelet Code:

    var form = nlapiCreateForm("My Form");
    var fhtml = form.addField("content", "inlinehtml", "Content");
    fhtml.setDefaultValue("");
    response.writePage(form);

    For example I’ve tried multiple variations of the following inlinehtml:

    <iframe src="" style="border:0; width: 100%; min-height: 500px;">


    But can’t seem to get the frame to fill the entire page vertically.

    Thank you!

    Reply
  9. Can you access an external website that requires login? For example, could the portlet direct to facebook.com and then each user have the ability to log onto the website? Basically, a browser portlet.

    Reply
  10. Hi Marty!
    Your posts on NetSuite are the best as usual.

    I wanted to know your thoughts on this. I need to render a page on a Portlet/Suitelet (doesn’t matter). Is there any way in which I can include a in this iframe so that it runs an http request and redirects the result somehow to NetSuite?

    The thing is that I have an API call that I need to make, but if I do it from the context of a SuiteScript with https.get(), I don’t get the response I need because is not my browser that is making the http call but NetSuite…and I need the call to be made with my browser because the call is expecting some cookies that will be only available there.

    If I make the call from an iframe, I know it works, but I’m not sure how to route that value back to NetSuite so that I can use it from there.

    Thanks in advance for your time!

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *