open to a snippet or a reason that it’s not possib...
# suitescript
a
open to a snippet or a reason that it’s not possible 🙂
t
Can you get it to work the way you want in a saved search built in the UI?
a
yea, but the export to search extension doesn’t allow for export
for this type of SS
t
Ahh, that was going to be my suggestion
a
haha, yeah, that’s usually the first move
but payment instrument search is kinda limited.. if i am not able to do it via a saved search, might have to do some iteration over the payment instruments sublist on the customer record
b
you probably want to learn how to work with searches not supported by the extension
anything that requires you to specify the type and id when you load the search isn't supported
i personally use the browser console to load the search and display the filter expression
Copy code
require(["N/search"], function(search) {
  console.log(
    search.load({ id: "100", type: search.Type.PAYMENT_INSTRUMENT })
      .filterExpression
  );
});
then work from there
from your filters, you appear to be using an an invalid filter (type) with an invalid search value (paymentcardtoken)
mainline looks unsupported as well
you will probably have to do the same thing with the columns, cardexpirationdate and cardlastfourdigits look like invalid columns
a
i mean, i get that the columns are returning as invalid, and i referred to the NS docs regarding the type filter
i am also trying to return results for both paymentcardtoken and paymentcard
so having that type filter is important
i think i will just load the search in ns and do some debugging to understand where i am going wrong
and use some formulas to get the field values that are ‘invalid’
p
I can see why they wouldn’t want you reading some of the data...
👆 1
b
the payment instrument type filter is not named type
and its values are numbers (dont put text values into filters that expect internal id numbers, netsuite might just ignore the filter)
j
netsuite might just ignore the filter
Perhaps the most dangerous behavior I've seen.. if it's what I'm thinking of May put a warning in the log that resembles
Removed an nlobjSearchFilter because it was invalid
but doesn't throw an error and runs your search anyway (without the filter)
a
ended up building a search in NS and destructuring it via logs, made some notes for myself for next time
Copy code
search.create({
        type: search.Type.PAYMENT_INSTRUMENT,
        filters: [
          {
            name: 'paymentinstrumenttype',
            operator: 'anyof',
            values: ['1', '2', '3'],
            isor: false,
            isnot: false,
            leftparens: 0,
            rightparens: 0
          },
          {
            name: 'customer',
            operator: 'anyof',
            values: [customer],
            isor: false,
            isnot: false,
            leftparens: 0,
            rightparens: 0
          }
        ],
        columns: [
          {
            name: 'entity',
            label: 'Customer',
            type: 'select',
            sortdir: 'NONE'
          },
          {
            name: 'paymentinstrumenttype',
            label: 'Payment Instrument Type',
            type: 'select',
            sortdir: 'NONE'
          },
          {
            name: 'paymentmethod',
            label: 'Payment Method',
            type: 'select',
            sortdir: 'NONE'
          },
          {
            name: 'paymentinstrumentstatetype',
            label: 'Payment Instrument State',
            type: 'select',
            sortdir: 'NONE'
          },
          {
            name: 'default',
            label: 'Default',
            type: 'text',
            sortdir: 'NONE'
          },
          {
            name: 'isinactive',
            label: 'Is Inactive',
            type: 'text',
            sortdir: 'NONE'
          },
          {
            name: 'lastfourdigits',
            label: 'Payment Card: Last Four Digits',
            type: 'text',
            sortdir: 'NONE'
          },
          {
            name: 'mask',
            label: 'Mask',
            type: 'text',
            sortdir: 'ASC'
          }
        ]
      });