TMann
TMann

Reputation: 781

NetSuite: Adding Available Filters to Portlet

I need to add 2 filters to a List Portlet. I have custom built code to display a report just the way we want it, however I want to add 2 available filters - Department (from a custom field) and Date (user wants to select what quarter).

I am aware how to add the nlobjSearchColumns array to the search results in the portlet script, but how can I add the ability for the user to select the values in the portlet?

Upvotes: 1

Views: 1210

Answers (1)

Rusty Shackles
Rusty Shackles

Reputation: 2840

How about creating a form Portlet where the user will first select the Department and Date values. Then when they click on submit, it will call a Suitelet that will return the search results.

Here is a sample code for the portlet. This is taken from NetSuite Help.

function demoSimpleFormPortlet(portlet, column)
{
    portlet.setTitle('Simple Form Portlet')
    var fld = portlet.addField('text','text','Text');
    fld.setLayoutType('normal','startcol');
    portlet.addField('integer','integer','Integer');
    portlet.addField('date','date','Date');
    var select = portlet.addField('fruit','select','Select');   
    select.addSelectOption('a','Oranges');
    select.addSelectOption('b','Apples');
    select.addSelectOption('c','Bananas');   
    portlet.addField('textarea','textarea','Textarea');
    portlet.setSubmitButton(nlapiResolveURL('SUITELET','customscript_simpleformbackend', 'customdeploy_simpleform'),'Submit');
}

Upvotes: 1

Related Questions