Skip to content

Commit

Permalink
Create getAttachmentsWhenReprorcessing
Browse files Browse the repository at this point in the history
  • Loading branch information
pacmano1 authored Mar 1, 2023
1 parent 2c95514 commit c858500
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions getAttachmentsWhenReprorcessing
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Courtesy of Nick Rupley from Mirth Slack - gets attachments when re-processing messages.

// Workaround until this is done better in Mirth Connect
function getOriginalAttachments(base64Decode) {
if ($('reprocessed') == true) {
var filter = com.mirth.connect.model.filters.MessageFilter();
filter.setMinMessageId(connectorMessage.getMessageId());
filter.setMaxMessageId(connectorMessage.getMessageId());
var messages = com.mirth.connect.server.controllers.ControllerFactory.getFactory().createMessageController().getMessages(filter, channelId, false, 0, 1);
if (messages.size() > 0) {
var originalId = messages.get(0).getOriginalId();
if (originalId) {
return AttachmentUtil.getMessageAttachments(channelId, originalId, base64Decode || false);
}
}
}

// Empty list
return Lists.list();
}

0 comments on commit c858500

Please sign in to comment.