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
File name (amending first 3 characters)
bso its
Hi
I have a script : to remove the characters WBS and replace with NIBTS
proc set_outbound_name {args} {
# Extract MODE safely
if {[catch {keylget args MODE mode}]} {
return ""
}
# ✅ Ignore startup call
if {$mode eq "start"} {
return ""
}
# Extract MSGID and ARGS safely
if {[catch {keylget args MSGID msgid}]} {
return ""
}
if {[catch {keylget args ARGS innerArgs}]} {
set innerArgs {}
}
# ✅ Get driverControl (this is where FILENAME lives)
set driverControl [msgget $msgid]
# Extract filename from driverControl list
if {[catch {keylget driverControl FILENAME fname}]} {
return [list CONTINUE $msgid $innerArgs]
}
set base [file tail $fname]
# DEBUG (leave enabled for now)
HciAlert -info "FINAL DEBUG: original filename = $fname"
if {[string match "WBS*" $base]} {
regsub {^WBS} $base "NIBTS" newbase
set dir [file dirname $fname]
set newfname [file join $dir $newbase]
# ✅ Write back into driverControl
keylset driverControl FILENAME $newfname
# ✅ Save updated driverControl
msgset $msgid $driverControl
HciAlert -info "FINAL DEBUG: new filename = $newfname"
}
return [list CONTINUE $msgid $innerArgs]
But it doesnt work -Any advice ?
Thanks in advance
Find more posts tagged with
Clovertech
Comments
Jason Russell
I don't see anything particularly wrong with the code. How is it not working? What is the echo of the $base going in and the $newbase coming out?
Jim Kosloskey
Don't you need to do a msgmetaget in order to get the DRIVERCONTROL keyed list?
Jason Russell
I missed that. You're correct:
set myklst [msgmetaget $mh DRIVERCTL]
keylget myklst FILENAME fileName
Pretty sure I ganked that from another script before I understood keylget.
bso its
Thank you for the replies (much appreciated)
Will make amends and let you know.
The issue is that its not attaching the "new" file name so its failing by saying file name is blank
Thanks again
bso its
Hi
I had a few errors in the code but below is a working tcl script :
proc set_outbound_name {args} {
set dispList {}
# Get mode
set mode ""
catch {keylget args MODE mode}
if {$mode ne "run"} {
return $dispList
}
# Get message ID
set msgid ""
catch {keylget args MSGID msgid}
if {$msgid eq ""} {
echo "DEBUG: MSGID missing"
return $dispList
}
# ✅ Get FULL existing DRIVERCTL
set driverControl [msgmetaget $msgid DRIVERCTL]
# Get original filename
set fname ""
catch {keylget driverControl FILENAME fname}
if {$fname ne ""} {
echo "DEBUG: Existing filename = $fname"
set base [file tail $fname]
if {[string match "WBS*" $base]} {
echo "DEBUG: WBS match found"
regsub {^WBS} $base "NIBTS" newbase
echo "DEBUG: New filename = $newbase"
# ✅ SAFE UPDATE — do NOT overwrite DRIVERCTL
keylset driverControl FILESET.OBFILE $newbase
# (optional but fine to keep)
catch {keylset driverControl OUTFILE $newbase}
# Save updated structure
msgmetaset $msgid DRIVERCTL $driverControl
echo "DEBUG: DRIVERCTL updated (OBFILE patched)"
}
}
# ✅ Correct return
lappend dispList "CONTINUE $msgid"
return $dispList
}
Thanks again for your help - much appreciated