Using Related Record Fields when Creating a Saved Search with SS2.0

Hello,

I am creating a Saved Search in SS2.0, and am confused on how to create a column from a related record. For example, if I am creating a Transaction type Saved Search, but want my results to show not just transaction fields, but fields from the related Item (like, Item:Name, in the NetSuite) how would I go about doing that? I can build such a search in NetSuite, but haven’t “scripted” one where this is needed yet.

I’ve been looking at something like


var myColumn = search.createColumn({

name: 'firstname',

join: 'salesrep'

});

 

but it doesn’t seem to be what I need. Thanks for any guidance!

Rookie Asked on September 10, 2019 in SuiteScript.
Add Comment
2 Answer(s)
Best answer

I use the script exporter extension when creating searches for scripts.

Just create the script in the UI then edit the search and you can use the exporter extension to give you the search in SS2.0

https://chrome.google.com/webstore/detail/netsuite-search-export/gglbgdfbkaelbjpjkiepdmfaihdokglp?hl=en-US

Beginner Answered on September 10, 2019.

Thanks! I had no idea about that extension. Just saved my afternoon!

on September 10, 2019.
Add Comment

General advice is to create the search in the ui and then translate it into code. If you want to do it manually, that generally involves loading the search you created in the browser console or debugger and then logging out the columns and then creating the matching code. There is a chrome extension that can help you out here (https://chrome.google.com/webstore/detail/netsuite-search-export/gglbgdfbkaelbjpjkiepdmfaihdokglp).

If you don’t like either of the above options, you are left with browsing through the suitescript record browser for fields and joins that look like they match.

In general the code you posted is the correct syntax for getting joins in a column. Keep in mind that you retrieve the values from the search result using the same parameters you used to create the column. For your example, that would mean

var firstWay = searchResult.getValue({
  name: "firstname",
  join: "salesrep"
});
var secondWay = searchResult.getValue(myColumn);
Advanced Answered on September 10, 2019.

Thank you, suitemike also mentioned the Chrome extension and I had to idea that was out there. After exporting my search into SS2.0 my problem was less with the columns and more with the filters, but the extension is a big plus.

on September 10, 2019.
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   Limebox   Become a Sponsor   Become a Sponsor