netsuitesuitescriptsaved-searches

How can I get a certain record’s system notes from SuiteScript?


I need to get the system notes of a transaction from a button on the transaction record form.

I tried to create a saved search of type SYSTEM_NOTE, however, SuiteScript returns the following error when the record filter is used as follows:

filters: [{
    name: 'record',
    operator: search.Operator.ANYOF,
    values: ['2252668']
}]

Can anyone give me an idea of how I can get a certain record’s system notes from SuiteScript?

Thanks!


Solution

  • You will receive an error using the filter shown in your question, because 'record' is not a valid filter for a SYSTEM_NOTE saved search. You can use 'recordid' instead. Note you should also use the EQUALTO operator, not ANYOF.

    filters: [{
        name: 'recordid',
        operator: search.Operator.EQUALTO,
        values: ['2252668']
    }]