SuiteQL REST API filter invoices by subsidiary
When trying to filter invoices by subsidiary via SuiteQL we get the following error:
{“type”:”https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1″,”title”:”Invalid search query Search error occurred: Field ‘subsidiary’ for record ‘transaction’ was not found. Reason: NOT_EXPOSED – Field is marked as internal for channel SEARCH\n.”,”status”:400,”o:errorCode”:”INVALID_PARAMETER”}
POST https://xxx-sb1.suitetalk.api.netsuite.com/services/rest/query/v1/suiteql
Data: {“q”:”SELECT id FROM transaction WHERE transaction.subsidiary = 49″}
Is it possible to filter invoices by subsidiary ID?
It is not listed here: https://5603533-sb1.app.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2020_1/analytics/record/transaction.html (but subsidiary taxRegnumber is)
Hi Laurens,
There’s subsidiary on Transaction Line though:
https://www.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2020_1/analytics/record/transactionLine.html
Strange that it’s not on the header but I guess maybe they flow it down to line level.
Hope that might help you.
Thanks,
Chris
Thanks Chris.
I can get the transaction IDS by filtering transaction lines on Subsidiary ID. But I only need the “Invoice” transactions with “status IS CustInvc:A”.
It seems this is not possible in one query.
What I can try to do is fetch all invoices via the REST API and select only the IDS that are returned from the SuiteQL query on Subsidiary ID. Very inefficient, but that should work.
Kind regards, Laurens
It seems this does the job: “SELECT id FROM transaction WHERE type = ‘CustInvc’ AND status = ‘A’ AND id IN (SELECT transaction FROM transactionline WHERE subsidiary = 19)”