messageHandler question on formatting for parameters

system.util.sendMessage(messageHandler="myMessageHandler", payload =myDictionary, scope="S")

I have a message handler called above with the dictionary defined above it.
However, I am having an issue getting the reception.

Seems like it only messes up when I try to add a payload or try to set the parameters by name.

The handler works if I try this:
system.util.sendMessage('myMessageHandler')

What is the proper way to configure the parameters for the send?
I think my send is not working.

Define "messes up". What happens ?

Also, according to the docs, the syntax is system.util.sendMessage(projectName, messageHandler, ...).
The first 2 parameters are not marked as optional, so try putting them in.

I would also check the scope is what you expect and want. Does the handler also work if you do:
system.util.sendMessage('myMessageHandler', scope="S")

I have run into issues trying to send messages with payloads of instances of my own custom classes. I would just check that your payload is exactly the data and types you expect.

That cannot be supported safely for message handlers outside the leaf project that created the custom class instances. There is a real risk of large memory leaks.

Yeah it made sense I couldn't do this once I figured out it was causing exceptions only when I sent custom class instances.

In our case we broke down our objects into native types and reconstructed the objects on the other side.

That seems odd to me since using only the name of the message handler works, but I will try again with the project name.

It seems odd to me that you're saying it works, but it may also have to do with where you are calling it from. Since message handlers are a project resource, I seem to recall there being an undocumented behavior where if it is called from within the containing project then it will still work. Or something along those lines.

Project Name should definitely be included in the call.

When I press the button with this, I write a variable correctly.

So far every way I write the parameter call though, nothing is called correctly as far as I can tell.

I don't get any errors either.

I am copy pasting the name of the handler.
When I check other posts though as recent as August, they have messageType = instead of messageHandler =.

I think I am typing something wrong, scope is wrong, or I have a syntax obstruction that doesn't throw an error.

In my test, I have a view with both the button in one flex container and various labels in other flex containers to see which will write.

Listener is configured for page and view.
Scope is default.

Where are you trying to send this message from and to?

system.util.sendMessage() and system.perspective.sendMessage() are different functions with different signatures and purposes.

1 Like

Thanks so much