infor.com
concierge
infor u
developer portal
documentation central
customer center
Posts
Categories
Groups
ERPs
CSD
FSM/HRT
LN
M3
Syteline/ CSI
Hubs
Developer
Healthcare
Hospitality
Public Sector
Onboarding
Release Center
CloudSuites
Aerospace & Defense (LN)
Automotive (LN)
Chemicals (M3)
Corporate (FSM/HRT)
Distribution (Sx.e/CSD)
Distribution Enterprise (M3)
Engineering & Construction (LN)
Fashion (M3)
Food & Beverage (M3)
Healthcare (FSM/HRT)
Industrial (Syteline/CSI)
Industrial Enterprise (LN)
Manufacturing (M3)
Public Sector (FSM/HRT)
Solutions
Supply Chain Management (SCM)
Human Capital Management (HCM)
Events
Groups
User Groups
Your Groups
About
Email Community Support
Infor News
Migrated Forums
Home
Clovertech
Clovertech Archive
Cloverleaf
Run tcl from alert
Gene Millard
I am trying to run a tcl from an alert.
I select tcl in the alert action
in the TCL Code box I have proc tpsFindNameSendEmail
Is this the proper way to run this?
Find more posts tagged with
Clovertech
Comments
Peter Heggie
Yes. I just built one in a test site..
Here is the start of the proc I referenced:
proc send_SMTP {debug module email_to email_fr email_cc email_bc email_subject email_body table} {
package require mime
package require smtp
set module "$module.send_SMTP"
if {$debug > 1} {echo "$module email_su $email_subject"}
Here is the invocation in the Alerts file entry - tcl proc window:
send_SMTP "2" "alerts" "peterheggie@crouse.org" "dlitinterfaces@crouse.org" "" "" "tcl test subject" "tcl test email body" "Send_SMTP_Email"
After putting this in, and meeting the alert condition, I received my test email. What this tells me is:
I can invoke tcl procs stored in the site's tclprocs library
I expect that master site procs are also useable
I can pass parameters as normal, even with some positional parameters empty, without problem
Using echo functions sends the output to the hcimonitord.log file, although I suspect that Infor does not recommend doing this.
There are also 'site-level' variables that you can use in your code or passed parameters; I believe the list of these variables are in the documentation somewhere.
Gene Millard
The tcl sends the test email from the testing tool and when I put it in a route. I cannot get it to send from the alert. I have a notify in the alert to show that the alert is firing and it is.
proc tpsSendAlertEmail { args } {
Alert Action: tcl
TCL Code: tpsSendAlertEmail
Peter Heggie
ok I'm stumped, so far.. can you put some echo statements in "tpsSendAlertEmail", just to see how far it gets? Did you store the tcl in the <site>/tclprocs folder and run "mktclindex" ? Look for the echos in ../<site>/exec/hcimonitord/hcimonitord.log
Gene Millard
I created and saved the tcl using IDE so everything should be in the proper place.
in my actions window I have
tcl tpsSendAlertEmail
notify {}
I get this from the log
[aler:aler:ERR /0:_hcimonitord_:09/09/2020 11:26:36] Tcl error: invalid command name "tpsSendAlertEmail"
[aler:aler:WARN/0:_hcimonitord_:09/09/2020 11:26:36] Calling doActions(5, alert {{action notify} {name default.Alert_2} {type pid} {source {
[aler:aler:WARN/0:_hcimonitord_:--/--/---- --:--:--] {
[aler:aler:WARN/0:_hcimonitord_:--/--/---- --:--:--] { DAEMON hcilockmgr }
[aler:aler:WARN/0:_hcimonitord_:--/--/---- --:--:--] }
[aler:aler:WARN/0:_hcimonitord_:--/--/---- --:--:--] }} {repeatcnt 0} {message {Process hcilockmgr has been running for 35 seconds}} {gendate 1599665196} {host clovertest} {root /opt/cloverleaf/cis19.1/integrator} {site gene}})
Peter Heggie
I am reaching my limit! Can you try removing 'tcl' from in front of the tps name?
Gene Millard
I cannot remove that. The system puts that in when I select tcl as the alert action.
There are six actions. I am selecting tcl. Is that the correct action?
callback
email
exec
none
notify
tcl
Peter Heggie
yes, tcl is the right action. It should work. When I tested my tcl I did not have notify{} in the window.
Gene Millard
I took the notify out. It seems no matter what I do I get the same error.
Tcl error: invalid command name “tpsSendAlertEmail”
I am not trying to pass any variables. Just trying to get it to work.
Does the tcl show up in front of your tcl?
Peter Heggie
ok so the top window in the Actions section has notify {} as the default. I change the Alert Action drop down to tcl. In the TCL Code window, I paste the invocation of my proc:
send_SMTP “2” “alerts” “peterheggie@crouse.org” “dlitinterfaces@crouse.org” “” “” “tcl test subject” “tcl test email body” “Send_SMTP_Email”
I click on the Update button. After clicking, the top window changes - the notify {} is removed, and my tcl invocation string is copied in, exactly as I pasted it in the TCL Code window below, except that it is prefixed with 'tcl' and then my entire invocation is enclosed in curly brackets. So it looks like this:
tcl {send_SMTP “2” “alerts” “peterheggie@crouse.org” “dlitinterfaces@crouse.org” “” “” “tcl test subject” “tcl test email body” “Send_SMTP_Email”}
Also the above parameters are delimited by quotes, but these are the 'slanted' quotes you see in Word, not the regular 'straight up and down' quotes. So I had to change the slanted quotes to straight quotes.
I did not click on any of the text icons (Append, Delete, Cut, Copy, Paste) and I did not click on the Advanced button.
I clicked on the plus sign in the Trigger window to create the rule, and then clicked Save on the File menu.
The alert is setup on a thread status down. I recycled the Monitor daemon and received the email.
System
Originally posted by Levy Lazarre
Hi Gene,
Here is another way of doing this (run your script as a command instead of Tcl)
Instead of selecting "tcl" for your action, select "exec".
In the "Command:" textbox, enter the name of your Tcl proc tpsSendAlertEmail.tcl and click on the "Update" button.
In order for Cloverleaf to find your new command, you need to place your Tcl script "tpsSendAlertEmail.tcl" in the $HCIROOT/usercmds directory because this is where Cloverleaf looks by default.
Also must make this file executable on the command line by using chmod +x
Good luck.
Gene Millard
I finally got it to work.
Since I have
proc emailAlert { args } {
in my tcl I had to set the action to
emailAlert "ARG1 six"
to pass in an arg.
Thank you for your time.