SuiteScript v1.
Searching on the item record type.
customrecord_sp_ecom_item_infoseo is a custom record type with a field called custrecord_sp_ecom_item_seo that references an item record. It also has a field called custrecord_sp_ecom_description, which is of type text.
I want to search for the items where the word "frozen" appears in custrecord_sp_ecom_description in the linked customrecord_sp_ecom_item_infoseo record and I want to use filter expressions.
Here's my expression:
[
[
"customrecord_sp_ecom_item_infoseo.custrecord_sp_ecom_description",
"contains",
"frozen"
]
]
And here's the error I get:
{"error" : {"code" : "SSS_INVALID_SRCH_FILTER_JOIN", "message" : "An nlobjSearchFilter contains an invalid join ID, or is not in proper syntax: custrecord_sp_ecom_description."}}
If I change the expression to:
[
[
"isonline",
"is",
true
]
]
then it works fine, albeit with the wrong results. So I know filter expressions can work, there's just something wrong with my expression.
How can I make it work?
When using the dot syntax for joins in filter expressions, the prefix of the dot is the ID of the field you are joining through, not the ID of the record type you are joining to (as it looks like you have here).
So, if I am searching Invoices, but I want to filter on the Sales Rep from the related Sales Order, it would look something like:
[
[ 'createdfrom.salesrep', 'anyof', salesReps]
]
Notice that it's not salesorder.salesrep
, but rather createdfrom.salesrep
because the createdfrom
field is what links the record I am searching (Invoices) to the record I am joining (Sales Order). The same applies when using custom records. Your join will be something like custrecord_fieldid.custrecord_sp_ecom_description
rather than using the record type.
来源:https://stackoverflow.com/questions/41494717/sss-invalid-srch-filter-join-when-using-filter-expression-on-joined-custom-field