Sublist – filter on 2 fields

From the customer record, I am trying to create a sublist of Sales Orders.


Name = This Customer Record


Project : CustomNameField = This Customer Record


I can easily get a saved search to work by setting the criteria to a specific customer, but I want it to be dynamic such that the search works as a sublist.

Other option I have tried is using a formula to match on a customer internal ID. If I could somehow replace the hardcoded internal ID with a dynamic value from the parent record, or URL, that would work.


Sublist - filter on 2 fieldscriteria using fields directly

Sublist - filter on 2 fieldscriteria with formula

Rookie Asked on March 8, 2022 in Saved Searches.
Add Comment
1 Answer(s)

I’ve managed to get close with scripting it.

function beforeLoadSublist(type, form)


if (type=='edit' || 'view')


//add a sublist to the form. Specify an internal ID for the sublist,

//a sublist type, sublist UI label, and the tab the sublist will appear on

var orders = form.addSubList('custpage_openjobs', 'list', 'Open Jobs Test', 'general');
//add fields to the sublist

orders.addField('number', 'text', 'Doc No');

orders.addField('type', 'text', 'Type');

orders.addField('entity', 'text', 'Name');

orders.addField('status', 'text', 'Status');

orders.addField('totalamount', 'text', 'Amount');
// perform a record search. Set search filters and return columns for

// the search
var joblistResults = nlapiSearchRecord('transaction', null,


new nlobjSearchFilter('entity', null, 'anyOf', 1349811),

new nlobjSearchFilter('type', null, 'anyOf', 'SalesOrd'),

new nlobjSearchFilter('mainline', null, 'is', 'T')



new nlobjSearchColumn('number'),

new nlobjSearchColumn('type'),

new nlobjSearchColumn('entity'),

new nlobjSearchColumn('totalamount'),

new nlobjSearchColumn('status')




My issue now, is that the resulting sublist for fields like TYPE show SalesOrd  – ie the VALUE not the TEXT. So my results look like:

Doc No, Type, Name, Status, Amount

SO1234, SalesOrd, 1349811, fullyBilled,  456.34
SO1235, SalesOrder, 1349811, pendingFulfillment,  2355.22


When what I want in the results is like this:

Doc No, Type, Name, Status, Amount

SO1234, Sales Order, John Smith, Fully Billed,  $456.34
SO1235, Sales Order, John Smith, Pending Fulfillment,  $2355.22


How do you get a sublist search to return the TEXTS of the values instead of the VALUES



Rookie Answered on March 10, 2022.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.
  • This site made possible by our sponsors:   Tipalti   Celigo   Become a Sponsor   Become a Sponsor