There is little information on how to use expanded attachment tokens with the User API. It is not intuitive when creating an attachment via AttachmentUtil to be manually routed to another channel.
Suggestions:
Add method getExpandedAttachmentId() to com.mirth.connect.server.userutil.Attachment to retrieve it directly from the attachment. This is probably the most intuitive, but I realize that the Attachments do not currently carry channelId and messageId information.
Add method to com.mirth.connect.server.userutil.AttachmentUtil public static String expandLocalTokens(String raw, ImmutableConnectorMessage connectorMessage) { return getAttachmentHandlerProvider(connectorMessage.getChannelId()).reAttachMessage(raw, connectorMessage, false); } It's not immediately apparent that one of the four versions of AttachmentUtil.reAttachMessage can actually expand tokens instead of reattaching the attachment. It's not in the method description, but only detailed in the parameter description. That method returns a byte[] instead of a String.
Add a few examples in the javadoc for the AttachmentUtil class showing proper usage for creating and reattaching messages, including expanding tokens.
There is little information on how to use expanded attachment tokens with the User API. It is not intuitive when creating an attachment via AttachmentUtil to be manually routed to another channel.
Suggestions:
public static String expandLocalTokens(String raw, ImmutableConnectorMessage connectorMessage) { return getAttachmentHandlerProvider(connectorMessage.getChannelId()).reAttachMessage(raw, connectorMessage, false); }
It's not immediately apparent that one of the four versions of AttachmentUtil.reAttachMessage can actually expand tokens instead of reattaching the attachment. It's not in the method description, but only detailed in the parameter description. That method returns a byte[] instead of a String.Imported Issue. Original Details: Jira Issue Key: MIRTH-4323 Reporter: agermano Created: 2018-09-06T16:55:12.000-0700