hey Rudderstack team! I’m working on a transformat...
# support
m
hey Rudderstack team! I’m working on a transformation and wanting to know if sending 2 event for 1 is possible. The use case I have in mind is something like this: 1. event purchase_complete fires 2. within transformation, if user = X create a duplicate of the event and call it x_purchase_complete 3. transformation returned both purchase_complete and x_purchase_complete I’ve tried copying the event object in a transformation and return both the edited copy and original, but when running test I only ever get back 1 event and not 2 as expected. Anybody try anything like this before and/or know if it’s possible?
m
Hey There! 👋 Your message has been received by the RudderStack team. We will forward this request to your Technical Account Manager, and they will get back to you shortly. Please use the thread for any additional comments.
h
Sure, you can return an array of events
m
You can do something like this
Copy code
export function transformEvent(event, metadata) {
    const ev_copy = {... event}
    ev_copy.some_prop = "abcd";
    return [event, ev_copy];
}