Script
Use the Script function to create and execute custom processors by using JavaScript. It processes each record sequentially in a stream and allows you to write custom code to transform individual records. You use Script to add complex data transformations that other functions cannot achieve. Use Script in the following cases:
You need to perform complex transformations or enrichments on individual records
You want to add custom logic that does not involve aggregation across multiple records
Examples include masking sensitive data, such as redacting the last four digits of a payment card number to display as, --****-1234, or extracting and formatting data, such as pulling the domain name from email addresses to categorize users by organization.
Note!
If there is a syntax error in the Script function, the stream fails.
Prerequisites
To take full advantage of this function, you must know JavaScript well.