Referencing data in JavaScript in filter
Hello Community,
I need to filter based upon some more involved string parsing that is awkward for the point and click filter, but which JavaScript can handle easily. However, I cannot find examples as far as referencing the passed in JSON data. For other hooks, such as pre-map, there is the options.data[].fieldname format with function premap(options) syntax. In the filter, the object is "record" instead of data. I have tried, for example:
function filter (options) with options.record[0].amount, record[0].amount, record.amount, and just "amount"
I have also tried "data" instead of record, and tried using "record" as the passed in parameter.
Unlike the other J-Hook locations, this one does not offer a stub, which would be helpful.
Thank you for any insight into how to reference these data fields.
Jim
Comments
James K
Hi James,
Apology for a late reply. As a side note, in the future you may want to post this type of question that is not a connector specific in this space for more visibility.
On the left pane, you can navigate to Scripts by way of "Resources -> Scripts". Then on the Scripts page, you can create a new script, then choose insert function stub "filter". When you have created and saved the filter, you can choose this filter script when you are defining filter using javascript option.
Here is the screenshot of creating a filter with stub filter
Please sign in to leave a comment.