kdub
kdub

Reputation: 205

Suitescript 2 list.addRows from search results that have a join

I have a Suitescript search that is returning the following columns.

{"columns":[{"name":"trandate","label":"Date","type":"date","sortdir":"ASC"},{"name":"refnumber","label":"Reference Number","type":"integer","sortdir":"NONE"},{"name":"closedate","label":"Date Closed","type":"date","sortdir":"NONE"},{"name":"custbody_eft_bill_payment","join":"payingTransaction","label":"EFT Bill Payment","type":"checkbox","sortdir":"NONE"},{"name":"tranid","join":"payingTransaction","label":"Check Number","type":"text","sortdir":"NONE"},{"name":"amount","label":"Amount","type":"currency","sortdir":"NONE"}]}

And I am using the list.addRows() method to display the results in a suitelet list where I have defined the columns using the list.addColumns() method but I have not been able to successfully get the columns that are created from a join. I also can find no documentation on how to include them. I have tried the following

list.addColumn({ id: 'payingTransaction.tranid', label: 'Payment#', type: ui.FieldType.TEXT, }) list.addColumn({ id: 'tranid', label: 'Payment#', type: ui.FieldType.TEXT, })

Any help would be appreciated!

Upvotes: 1

Views: 779

Answers (1)

w3bguy
w3bguy

Reputation: 2250

Not sure if this will help, but when running through your results you can use one of two methods to get the resulting data:

  1. Use the join in the getValue() call

    results.getValue({name:"tranid",join:"payingTransaction"});

  2. Grab the data by Columns

    var columns=result.columns; var tranid=result.getValue(columns[0]);

The first option will need to be told whether it is a join, group, etc...

The second option will just grab the resulting column, no matter whether it is a join, group, or anything else.

Upvotes: 2

Related Questions