Hello everyone, I'm trying to get search results o...
# suitescript
l
Hello everyone, I'm trying to get search results of transactions limited to few types only. From what I can see search filters accept only abbreviated names like
CustInvc
or
SalesOrd
on
type
column. Do you know if there's a way to search by transaction type internal id instead? Or is there a way to map transaction type id/full name to abbreviated version?
b
If you're only searching for one type, then you could just set the type of the search to "invoice" or "salesorder" instead of "transaction".
l
Thanks, I need to search for several transaction types at once, splitting it into different searches is not an option really
b
Which version of SuiteScript are you using?
You could run a search beforehand to get the values for both record type and the filter type to use as a key/lookup.
❤️ 1
Copy code
search.create({
  type: search.Type.TRANSACTION,
  columns: [
    search.createColumn({
      name: 'recordtype',
      summary: 'GROUP',
    }),
    search.createColumn({
      name: 'formulatext',
      summary: 'GROUP',
      formula: '{type.id}',
    }),
  ],
});
Copy code
nlapiSearchRecord('transaction', null,
  [],
  [
    new nlobjSearchColumn('recordtype', null, 'GROUP'),
    new nlobjSearchColumn('formulatext', null, 'GROUP').setFormula('{type.id}')
  ]
);
b
the usual saved search advice applies, build your search in the ui first
the load the search to see what its filters/columns look like
there is an extension that can help
l
@battk yes, I do/I have it @burkybang SS2, I'm pulling list of record types from custom multiselect field. Thanks for your help, I think that's what I needed :)
👍 1