Skip to content

[BUG] channelName variable is not available in Postprocessor script #309

Closed

Description

@xabylr

Describe the bug
The channelName variable is not available in the Postprocessor script. It makes no sense that is not available, since it is available for the Deploy, Undeploy and Preprocessor scripts.

To Reproduce

  1. Create a channel with a Postprocessor script that makes use of the channelName variable.
  2. Send a message to the channel and observe that the variable does not exist.

Expected behavior
The variable channelName should be available in the Postprocessor script.

Actual behavior
The variable channelName is not available in the Postprocessor script.

Screenshots

Image Image

Environment:

  • Docker image: 4.5.2-ubuntu
  • OS: Linux
  • Java Distribution/Version: OpenJDK 17
  • Connect Version: 4.5.2

Workaround(s)
Obtain the channel name in other place that where is available and store it in another variable that the Postprocessor script has access to.

Additional context
There was already a bug report for Mirth Connect, but it was automatically closed without a fix: nextgenhealthcare/connect#3893

Activity

  1. added
    bug
    on May 20, 2026
  2. e210 commented on Jul 29, 2026

    @e210
    Contributor

    Confirmed on current main: JavaScriptScopeUtil.getPostprocessorScope reads channelName from message.getMergedConnectorMessage().getChannelName(), but Message.getMergedConnectorMessage() never populates channelName on the merged connector message — so the variable resolves to null only in the Postprocessor scope, exactly as reported:

    public ConnectorMessage getMergedConnectorMessage() {
    if (mergedConnectorMessage == null) {
    mergedConnectorMessage = new ConnectorMessage();
    mergedConnectorMessage.setChannelId(channelId);
    mergedConnectorMessage.setMessageId(messageId);
    mergedConnectorMessage.setServerId(serverId);
    mergedConnectorMessage.setReceivedDate(receivedDate);

    @giomedcontext's withdrawn #325 had the right fix (populate it from the Message's own field, falling back to the source connector message). @giomedcontext — do you plan to resubmit? If not, I'm happy to pick it up: same approach, rebased on the Gradle layout, with a regression test, credited to you.

  3. ggiannola commented on Jul 29, 2026

    @ggiannola
    Contributor

    @e210 I created a new PR to fix this: #395

  4. added a commit that references this issue on Jul 29, 2026
    a323c8f
  5. added a commit that references this issue on Jul 31, 2026
    ca111f9
  6. added this to the Next Release milestone on Jul 31, 2026
  7. added a commit that references this issue on Jul 31, 2026
    ac3a398
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions