Monday, March 11, 2019

Get Sales Order Transactions Related Records via SuiteScript

Here is the sample script on how to retrieve list of transactions in the related records tab for a particular sales order.
  1. Create a Scheduled Script using the following script:
    function getRelatedRecords(){    // Define search filters    var filters = new Array();    filters[0] = new nlobjSearchFilter( 'createdfrom', null, 'is', 79 );     //79 is the internal id of the sample sales order whose related records we are searching for    filters[1] = new nlobjSearchFilter( 'mainline', null, 'is', 'T' );    // Define search columns    var columns = new Array();    columns[0] = new nlobjSearchColumn( 'internalid' );    columns[0] = new nlobjSearchColumn( 'type' );    // Create the saved search    var search = nlapiCreateSearch( 'transaction', filters, columns );    var searchId = search.saveSearch('Get Related Records', 'customsearch_getRelatedRecords');}
  2. To check this, go to List > Search > Saved Searches and find the created search. The search is of type Transaction.

No comments:

Post a Comment