How to include attributes with NULL values in Custom Events (omitNullFields = false)?

Question

I created a map containing PX data that could include values or null. If I send this map using api.customEvent(), entries with null value are not included. Is this the expected behavior? What can we do to get the missing "key : null" pairs?

Answer

The method api.customEvent(Object object, String customEventType, String operation, boolean omitNullValues) allows you to set whether null fields are omitted in the payload or not.