How to use processingMode in Smart Function / Dynamic Mapper

Hi everyone,

I’m trying to send measurement data in Cumulocity in TRANSIENT mode via a Smart Function in the Dynamic Mapper, so that the data is processed by Streaming Analytics but no measurement is stored in the database.

In my Smart Function, I currently push results like this:

return [{
  cumulocityType: "measurement",
  action: "create",
  payload: {
    "time": measuredAt,
    "type": "mqtt-measurement",
    "processingMode": "TRANSIENT",
    "mqtt-measurement": {
      "BatteryVoltage": {
        "unit": "V",
        "value": payload["data"]["a_batteryVoltage"]
      }
    }
  },
  externalSource: [
    { "type": "c8y_Serial", "externalId": payload["device_id"] }
  ]
});

The processingMode field is visible in the created measurement:

json{
  "id": "4610994",
  "type": "mqtt-measurement",
  "time": "2026-07-09T12:00:06.142Z",
  "processingMode": "TRANSIENT",
  "mqtt-measurement": {
    "BatteryVoltage": {
      "unit": "V",
      "value": 3.77
    }
  }
}

However, the measurement is still persisted in the database, so the TRANSIENT mode does not seem to have any effect in this case.

When I use a JSONata mapping instead, it works as expected and no measurement is stored. The working JSON looks like this:

json{
  "time": "2026-07-09T08:14:49.389+02:00",
  "type": "mqtt-measurement",
  "_IDENTITY_": {
    "externalId": "any_SerialNumber"
  },
  "_CONTEXT_DATA_": {
    "api": "MEASUREMENT",
    "processingMode": "TRANSIENT",
    "deviceName": "generatedDevice",
    "deviceType": "c8y_MQTTDevice"
  }
}

How should the payload be structured in a Smart Function / Dynamic Mapper so that processingMode = TRANSIENT is actually respected and no measurement is stored?

Any examples or best practices would be really appreciated.

Kind regards

Valerian

Hi Valerian,

the documentation might be improvable but the following should work:

return [{
  cumulocityType: "measurement",
  action: "create",
  payload: {
    "time": measuredAt,
    "type": "mqtt-measurement",
    "mqtt-measurement": {
      "BatteryVoltage": {
        "unit": "V",
        "value": payload["data"]["a_batteryVoltage"]
      }
    }
  },
  externalSource: [
    { "type": "c8y_Serial", "externalId": payload["device_id"] }
  ],
  contextData: {
     processingMode: "TRANSIENT"
  }
}];

Here are all options of contextData:

    contextData?: {
        /** Display name of the implicitly created device */
        deviceName?: string;
        /** Managed object type of the implicitly created device */
        deviceType?: string;
        /** Processing mode: "PERSISTENT" (default) or "TRANSIENT" */
        processingMode?: "PERSISTENT" | "TRANSIENT";
        /** Additional fragments merged into the device MO on first creation */
        deviceFragments?: Record<string, any>;
        /** Group names the device is added to as a child asset (created if missing) */
        deviceGroups?: string[];
        /** Binary attachment fields for EVENT types */
        attachmentName?: string;
        attachmentType?: string;
        attachmentData?: string;  // Base64-encoded
    };

It is part of the built-in documentation but hard to find as it is Transformation Type → Smart Function.

Hi Stefan,
thanks for the information, that’s very helpful. I checked the Cumulocity documentation but didn’t find anything. I didn’t consider that the solution might be in the built‑in documentation. It might be beneficial to have all the documentation available in a central place.

I’ll test this a bit and then give feedback on whether it worked. Since it’s documented this way, I don’t see any reason why it shouldn’t work. Thanks again for your reply and the information provided.