I am trying to search for item_fulfillment contain...
# suitescript
e
I am trying to search for item_fulfillment containing a specific inventorynumber. But Im doing something wrong with the joining.
Copy code
search.create({
      type:search.Type.ITEM_FULFILLMENT,
      filters: ['inventorynumber', 'is', 'bcy32scy'],	  
      join:['inventorydetail'],
      columns:['entity']
  }).run()
    .each(function(result) {
      log.debug(result);
      return true;
    });
s
Have you looked at the api for
search.create()
? Join is not a parameter it takes.
k
search.create()
does not have a
join
option parameter, joins are done within the columns option parameter e.g.
inventorydetail.entity
or
search.createColumn({ name: 'entity', join: 'inventorydetail'})
I highly highly highly suggest using the Chrome
Netsuite: Search Export
extension, which allows you to save a search in the UI and then have it create the equivalent
search.create()
variable for you with all the joins, correct field names, etc
e
Thank you
s
Also
log.debug()
, takes 2 parameters, trying to log that much as the title will not produce anything of value.
e
I know. It was just to show that there was (or was not) a result 🙂
s
technically,
log.debug()
has 1 parameter - the dastardly
options
object.
just sayin
(unless you're using NFT which does indeed take the more sane two params for title/details)
however, I'm guilty of using the 2 parameter version myself... it's a lot less typing and cleaner looking imho
var myValue = 'value'; log.debug({ title: 'Debug Entry', details: 'Value of myValue is: ' + myValue });
👎 1
Anyway, don't mean to hijack thread, back to regularly scheduled programming.
e
Thanks @stalbert 🙂 I still can't get my head around the search-join. This is what I have so far, but it hangs the debugger 😕
Copy code
search.create({
      type:search.Type.ITEM_FULFILLMENT,
      filters: [search.createFilter({
                            name: 'inventorynumber',
                            join: 'inventorydetail',
                            operator: <http://search.Operator.IS|search.Operator.IS>,
                            values: ['bcy32scy']
                        })],	  
      columns:['entity'] // or any field from Item-Fulfillment
  }).run()
s
maybe this is easier with SuiteQL? I can't say I know how to get to inventory detail via SuiteQL off the top of my head but @tdietrich might!
s
I would
IS
is the problem, doesn't it use
ANYOF
when you make the search in the UI?
👍 1
I believe the
IS
operator is for text fields, not select fields.
s
I'm pretty sure
is
works on select fields too. battk can probably provide the help link where there's a table showing which operators work with each field type.
s
1.0 table says
IS
is for checkboxes and email/text
s
Good find Sandii - looks like indeed
ANYOF
is the safe bet.