ParamNum function for Sysex?

Can anyone help me?
I want to make a standardized Sysex json message I can reuse in almost all SysEx controls of a certain preset. It should make it much faster to build presets.
The Sysex message should look like this:

    "type": "function",
    "name": "getChannelByte"
    "type": "function",
    "name": "getParamNum"
    "type": "value"

The first 5 bytes are typical for a Parameter Change for the Korg 03R/W.
But it’s the sixth byte I struggle with.
I’ve made a function looking like this:

function getParamNum(valueObject) 
    local message = valueObject:getMessage ()
    local paramNum= message:getParameterNumber ()
   return paramNum

But that doesn’t work. It returns the error “error running function ‘runTemplateFunction’: ctrlv2/p003.lua:21: method ‘getMessage’ is not callable (a nil value)” And the browser and the Electra One hang after this.

Don’t you need two parameters? getParamNum(ValueObject, Value) rather than just the one?

I think the missing parameter causes the stack to be messed up and causes the getMessage() call to fail.