#1
|
|||
|
|||
![]()
Is there a way to set a variable (a new variable) in the alert map from a channel?
|
#2
|
||||
|
||||
![]()
Well obviously you can always use the global map. However that's not ideal since you have to worry about map key collisions.
The alert template uses Velocity so technically you can do some rather complex things. For example say you sent an alert message that is really JSON: Code:
var alert = { message: 'The message', customfield: 'Custom' }; alerts.sendAlert(JSON.stringify(alert)); Code:
$g('jsonParser', new JavaAdapter(java.lang.Object, { get: function(json, name) { return JSON.parse(json)[name]; } })); Code:
#set($index=$error.indexOf('ERROR MESSAGE: ')+15)#set($json=$error.substring($index))Message: $jsonParser.get($json,'message') Custom Field: $jsonParser.get($json,'customfield')
__________________
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. ![]()
|
#3
|
|||
|
|||
![]()
What we are trying to do is have the sendto email as a variable as it will change based on certain conditions. We tried the GlobalMap put is was not available to use in the alert.
|
#4
|
||||
|
||||
![]()
Hm, just tried and it seemed to work fine for me.
__________________
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. ![]()
|
![]() |
Thread Tools | |
Display Modes | |
|
|