Ask Your Question

How to create custom events in JavaScript Evaluator.

asked 2018-07-18 00:08:45 -0500

Kumar gravatar image

How to create a custom events when all records are processed in JavaScript Evaluator.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-07-18 21:04:06 -0500

metadaddy gravatar image

Follow these instructions from the documentation to generate events from the JavaScript Evaluator:

  1. On the General tab, select the Produce Events property.

    This enables the event output stream for use.

  2. In the script, include both of the following scripting objects:

    sdcFunctions.createEvent(String type, int version) - Creates an event record with the specified event type and version number. You can create a new event type or use an existing event type. Existing event types are documented in other event-generating stages.

    The event record contains no record fields. Generate record fields as needed.

    sdcFunctions.toEvent(Record) - Use to pass events to the event output stream.

For example:

// Write an event if the record has a field /f1 wih value 123
if (records[i].value['f1'] === 123) {
  var event = sdcFunctions.createEvent('my-event-type', 1);
  // Can set whatever fields you like
  event.value = { payload: '123 detected!' };

In preview:

image description

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2018-07-18 00:08:45 -0500

Seen: 474 times

Last updated: Jul 18 '18