Reputation: 781
I am trying to add a search filter to a search in SuiteScript. What I want to filter is the date a custom record is created. The search is off a job (or Project) record, but the custom record is connected to the job (this needs to be off the job for other reasons).
In the UI this would like like: CustomRecordName : Date Created (and as a filter you would select the filter you want, such as within this fiscal quarter).
I know the syntax:
new nlobjSearchFilter(fieldId, join, operator, value1, value2);
I went to the custom record and the "Date Created" fieldId is 'created'. My Custom record's id is: customrecord301.
Here is what I have for my specific case:
filters.push(new nlobjSearchFilter('created', 'customrecord301', 'within', 'thisfiscalquarter'));
I get the following error: An nlobjSearchFilter contains an invalid join ID, or is not in proper syntax: created.
What am I missing/doing wrong?
Upvotes: 1
Views: 4539
Reputation: 51
You don't need to put any value in 'join' until and unless you are executing a joined search.
Please try this filters.push(new nlobjSearchFilter('created', null, 'within', 'thisfiscalquarter'));
Upvotes: 0
Reputation: 8847
The join
parameter should be the ID of the field you are joining through instead of the record type you are joining to. Instead of "customrecord301", you need the ID of the list/record field on the Project (job) record.
Upvotes: 2