HI All
We recently upgraded a customer for the latest patch level of sage X3 V12 2023 R1 (12.0.33), we had older code that sent out an email when the user changed the bank details of a supplier. We did this with a call to ENVOI_MAIL from AWRKMEL. Code was working fine for several years now.
After the upgrade i get an error 69 - wrong number of parameters when calling the function.
I checked my local x3 folderand the source code for AWRKMEL is not available, i searched the TRT folder for file contents with ENVOI_MAIL, but it also doent find anything. So really i dont have anything to go on with here.
I searched other foruns and example calls to ENVOI_MAIL are older and like mine...
I tried 2 changes that also didnt work: adding 2 empty strings at the end of the call, and adding an integer with a zero (i should be so lucky).
Any help will be welcome, many thanks in advance.
The code i have today is this:
Subprog SEND_MAIL(PTO,PCC,PSUBJECT,PTEXT,PJOINFIC)
Value Char PTO
Value Char PCC
Value Char PSUBJECT
Value Char PTEXT
Value Char PJOINFIC
# YTYPMES: 1 = use the global parameter GTYPMES, 2 = sent by server, 3 = sent by client
# YREQREC: 2 = request receipt status
# YREQIMP: Importance 1=Low 2=High
Local Shortint MAXUSER : MAXUSER=10
Local Integer YTYPMES : YTYPMES = 1
Local Integer YREQREC : YREQREC = 0
Local Integer YREQIMP : YREQIMP = 0
Local Char YUSER(20) : YUSER = GUSER
Local Char YMAIL(250) : YMAIL = ""
Local Char YOBJJOI(250) : YOBJJOI = ""
Local Char YCLEOBJ(250) : YCLEOBJ = ""
Local Char YCHRONO(250) : YCHRONO = num$([C]CHRNUM) : [C]CHRNUM += 1
# 0 -> No detailed trace. >1 -> Write detailed trace
Local Integer YERD
YERD = val(func AFNC.PARAMDOS(nomap,"TRAMEL"))-1
Local Char YUSR_EMAIL(250)(0..[L]MAXUSER)
Local Integer YUSR_ENVOI(0..[L]MAXUSER)
Local Integer YUSR_SUIVI(0..[L]MAXUSER)
Local Integer YUSR_NB
Local Clbfile YTEXCLB
Local Char YTEXOBJ(250) : YTEXOBJ = PSUBJECT
Local Char YPCEJOI(250)(1..99)
Local Integer YNBJOI
Local Char YTYPJOI(250) : YTYPJOI(0) = ""
Local Integer YCATJOI : YCATJOI = 0
Local Char YCONTXT(250) : YCONTXT(0) = ""
#Local Char CONTXT_DESKTOP(250) : CONTXT_DESKTOP(0) = "" -- No joy adding this to the call to envoy_mail, customer came back saying the error is still there
#Local Char CONTXT_MOBILE (250) : CONTXT_MOBILE (0) = ""
#
#Recipients
#
YUSR_NB = 0
Local Integer I
For I = 0 To dim(PTO) - 1
If vireblc(PTO(I),2) <> ""
YUSR_EMAIL(YUSR_NB) = vireblc(PTO(I),2)
YUSR_ENVOI(YUSR_NB) = 2
YUSR_NB += 1
Endif
Next
For I = 0 To dim(PCC) - 1
If vireblc(PCC(I), 2) <> ""
YUSR_EMAIL(YUSR_NB) = vireblc(PCC(I), 2)
YUSR_ENVOI(YUSR_NB) = 3
YUSR_NB += 1
Endif
Next
#
# Attachment
#
YNBJOI = 0
For I = 0 To dim(PJOINFIC) - 1
If vireblc(PJOINFIC(I),2) <> ""
YNBJOI += 1
YPCEJOI(YNBJOI) = vireblc(PJOINFIC(I),2)
Endif
Next
Setlob YTEXCLB With PTEXT
#LVM 05-09-2023
# CODE WAS THROWING ERROR: WRONG NUMBR OF PARAMETERS CALLING cALL envoi_mail
# IF ADDING A ZERO DOESNT WORK WE CAN TRY TO ADD TO TEXT VARIABLES TO THE END OF THE CALL, THERE IS A SIMILAR FUNCTION
# ENVOI_MAIL_SYRA HAS MORE 2 CONTEXT VARIABLES IN THE CALL, CONTXT_DESKTOP, CONTXT_MOBILE WE CA ALSO TRY ADDING THESE 2
Call ENVOI_MAIL(YTYPMES,YREQREC,YREQIMP,YUSER,YMAIL,YOBJJOI,YCLEOBJ
& ,YCHRONO,YERD,YUSR_EMAIL,YUSR_ENVOI,YUSR_SUIVI,YUSR_NB
& ,YTEXCLB,YTEXOBJ
& ,YPCEJOI,YNBJOI,YTYPJOI,YCATJOI,YCONTXT ) From AWRKMEL
End