web stats
Accessing transformed and error message in alert - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 06-13-2014, 05:40 AM
aurdipas aurdipas is offline
Mirth Newb
 
Join Date: Feb 2012
Location: Basel
Posts: 6
aurdipas is on a distinguished road
Default Accessing transformed and error message in alert

I want to access the transformed message and the error I get from a request response in my alert template message.

What I did is setting 2 global variables in the postprocessor script of my channel and then I read them in the alert.
globalMap.put("requestError", responseMap.get("d"+j).getMessage());
globalMap.put("transformed", connectorMessage.getTransformedData());

I'm not so sure this is the best way to access these values.

Any suggestion?
Reply With Quote
  #2  
Old 06-16-2014, 06:57 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,123
narupley is on a distinguished road
Default

Another way to do it is to send a custom event with alerts.sendAlert, with your own custom message. That way it can include whatever information you want.

If you go the global map route, make sure that those keys are unique and won't collide with other channels. Since multiple messages may trigger the same alert, it would be prudent to use some kind of queue or something in the actual map value.
__________________
Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

Nicholas Rupley
Work: 949-237-6069
Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


- How do I foo?
- You just bar.
Reply With Quote
  #3  
Old 06-17-2014, 03:32 AM
AlexNeiva AlexNeiva is offline
Mirth Guru
 
Join Date: Oct 2013
Location: Portugal
Posts: 277
AlexNeiva is on a distinguished road
Default

other option is logger.info();
But the alerts option suits better i guess
Reply With Quote
  #4  
Old 06-23-2014, 05:41 AM
aurdipas aurdipas is offline
Mirth Newb
 
Join Date: Feb 2012
Location: Basel
Posts: 6
aurdipas is on a distinguished road
Red face

Thanks for the suggestions but I need to access just these values in the alert and I can through global variables in the postprocessing but I just realized that doing this in the postprocessing it creates a problem.
Since the alert is launched before the postprocessing script on the first "error" I'm not getting any value in the alert. The errors just arrive from second error.
Nobody knows any other way to access the transformed message and the error I get from a request response in my alert template message?

Reply With Quote
Reply

Tags
alerts, transformed data

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 02:21 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Mirth Corporation