2

I need a search that looks for line items with a specific value in a custom field - custcolunique_id

I am using the search below, but am getting a SSS_INVALID_SRCH_OPERATOR error due to custcolunique_id. That is definitely the internal field ID since I'm using it elsewhere in code without issue. Is there additional syntax needed in searches to specify that I want to look for a sublist item, or is there a different way entirely that I should be doing this?

var recordSearch = search.create({
            type: search.Type.PURCHASE_ORDER,
            columns: ['custcolunique_id'],
            filters: [['mainline', 'is', 'F'],
                'and', ['custcolunique_id', 'is', '123']]
        });
djbrazzy
  • 21
  • 4

1 Answers1

0

You have the correct approach, but the error is telling you that your Operator ('is') is not valid for your field type. You need to use an Operator that is valid for custcolunique_id's field type. 'is' is only valid for text fields and checkboxes.

You can see valid Operators by field type in Help:SuiteScript 1.0 Search Operators. Despite the page title, the content is applicable to 2.0 as well.

erictgrubaugh
  • 8,519
  • 1
  • 20
  • 28
  • 1
    ```custcolunique_id```'s field type is Free-Form Text which the 'is' should work on according to that table. I tried 'equalto' and it stopped the error appearing but revealed other issues in my code. In the process of fixing those something clicked because using 'is' is now working again in this search and I'm not really sure why it wasn't before. Thank you for putting me on the right path - I also really appreciate your tuts, they've helped me out a bunch! – djbrazzy Nov 11 '20 at 21:32