NetSuite: SEC EDGAR Integration Portlet

Published on August 25, 2021.

As a contract NetSuite developer, I'm often presented with opportunities to work on interesting projects. For example, I was recently asked by one of my clients, a financial technology ("Fintech") firm, to research integrating NetSuite with EDGAR, the Electronic Data Gathering, Analysis, and Retrieval system provided by the U.S. Securities and Exchange Commission (SEC). EDGAR is a publicly accessible database of the financial disclosure documents that have been submitted to the SEC by various entities, whether they're companies or individuals, that are required by law to make those submissions.

As a proof-of-concept for what will eventually be a much more complex and robust application, I created a SuiteScript Portlet that retrieves recent filings data from EDGAR for specified entities. It then displays a few of the most recent filings that have been made by each entity, with links to each filing's index and primary document.

Here's a short animation showing the portlet in action.

In this example, the portlet is retrieving data for two entities: Apple (CIK320193) and Oracle (CIK1341439). A CIK (Central Index Key) is assigned to each entity that is filing disclosures with the SEC. You can lookup CIKs here: https://www.sec.gov/edgar/searchedgar/cik.htm

The SuiteScript is pretty straightforward. Regardless, I think other developers might find it to be interesting and potentially helpful. And so with my client's permission, I'm sharing the script below.

To use the script, simply adjust the "ciks" array with the CIK codes that you want to display filings for. Also, be sure to set the "userAgent" variable with your name and email address. And finally, note that you can adjust the number of filings that are displayed by adjusting the "maxFilings" value.

I hope you find the script to be helpful. If you have any questions about it, please feel free to reach out to me.

sec-edgar-filings.v202101.portlet.js
/**
* @NApiVersion 2.1
* @NScriptType Portlet
* @NModuleScope SameAccount
*/

/* 

------------------------------------------------------------------------------------------
Script Information
------------------------------------------------------------------------------------------

Name:
SEC Edgar Filings

ID:
_sec_edgar_filings

Description:
Retrieves and displays SEC filings via EDGAR.

Portlet Type:
Inline HTML


------------------------------------------------------------------------------------------
Developer(s)
------------------------------------------------------------------------------------------

TD:
• Tim Dietrich
• timdietrich@me.com


------------------------------------------------------------------------------------------
History
------------------------------------------------------------------------------------------

20210825 - TD
Initial version.	

*/


var 
	ciks = ['CIK0000320193', 'CIK0001341439' ],
	https,
	maxFilings = 5,
	userAgent = 'Your Name your@emailaddress.com';


define( [ 'N/https' ], main );


function main( httpsModule ) {

	https = httpsModule;
	
    return {
        render: renderContent
    }

}


function renderContent( params ) {
		
	params.portlet.title = 'EDGAR Filings Summary';
	
	var content = '<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">';
	
	for ( let i = 0; i < ciks.length; i++ ) {

		var response = https.get( 
				{ 
					url: `https://data.sec.gov/submissions/${ciks[i]}.json`,
					headers: [ { 'User-Agent': userAgent } ]
				} 
			);
						
		if ( response.code == 200 ) {
		
			try {
		
				response = JSON.parse( response.body );
				
				var filings = response.filings.recent;
		
				content += '<div style="margin-bottom: 12px;">';		
				content += `<span style="font-weight: bold;">${response.name}</span><br>`;			
				content += '<table class="table table-sm table-bordered table-hover table-responsive-sm>';
				content += '<thead class="thead-light" style="background-color: #eee;">';
				content += '<tr>';
				content += '<th width="15%">Date</th>';
				content += '<th width="10%">Form Type</th>';
				content += '<th width="75%">Primary Document</th>';
				content += '</tr>';
				content += '</thead>';
				content += '<tbody style="background-color: #fff;">';
				for ( let x = 0; x < filings.primaryDocument.length; x++ ) {		

					var cik = response.cik;
					var accessionNumber = filings.accessionNumber[x].replace( /-/g, '' );
					var primaryDocument = filings.primaryDocument[x];
			
					var filingURL = `https://www.sec.gov/Archives/edgar/data/${cik}/${accessionNumber}/`;
					var docURL = `https://www.sec.gov/Archives/edgar/data/${cik}/${accessionNumber}/${primaryDocument}`;
				
					content += '<tr>';
					content += `<td>${filings.filingDate[x]}</td>`;
					content += `<td><a href="${filingURL}" target="_new">${filings.form[x]}</a></td>`;
					content += `<td><a href="${docURL}" target="_new">${filings.primaryDocDescription[x]}</a></td>`;
					content += '</tr>';		
				
					if ( x == maxFilings ) { break; }	
				
				}
				content += '</tbody>';						
				content += '</table>';			
				content += '</div>';
				
			} catch(e) {
				log.debug( { title: 'Submissions Get Error ' + ciks[i], details: e } );
				content += `<p style="color: red;">Error: Unable to get submissions for: ${ciks[i]}</p>`;			
			}
			
		} else {
			log.debug( { title: 'Submissions Get Error', details: ciks[i] } );
			content += `<p style="color: red;">Error: Unable to get submissions for: ${ciks[i]}</p>`;
		}

	}
	
	params.portlet.html = content;

}
About Me

Hello, I'm Tim Dietrich. I develop custom software for businesses that are running on NetSuite, including mobile apps, Web portals, Web APIs, and more.

I'm the developer of several popular NetSuite open source solutions, including the SuiteQL Query Tool, SuiteAPI, and more.

I founded SuiteStep, a NetSuite development studio, to provide custom software and AI solutions - and continue pushing the boundaries of what's possible on the NetSuite platform.

Copyright © 2025 Tim Dietrich.