Probably hardcore newbie problem ;-)

Hey there, hope some of you guys (and girls ?) can help me. I added a new flowfield which shows me an email adress from another table (depending on a filter). No I wanna open a new mail via Outlook. I have the code from an e-mail field a former colleque of mine wrote. So, everything great but at a lenght of more then 10 field of the email adress I get following message (roughly translated) : “Overflow during the conversion of type of text to code” All properties are exactly the same as in the working e-mail field. Any hint where the problem might be ? Thx´s in advance, Christian Rettig Cycos AG cre@cycos.com Overflow during the conversion - text to code

Hi Christian! I think the problem is caused by the code your collegue wrote, just check it out with the debugger: the error occurs e.g. if you assign a string length >10 to a text/code-field length <=10. But I recommend not to use your own “e-mail code”. There is codeunit 397 Mail (in NF 2.60) which does the job (function “NeuMitteilung”)! Regards, Jörg Joerg A. Stryk Apollo-Optik, IT/ERP

Here´s The code I use : IF EmailEnd <> ‘’ THEN BEGIN IF tmp_emailend.GET(“Endkundenr.”,EmailEnd) THEN BEGIN anrede := tmp_emailend.Anredewahl; IF anrede = anrede::“Sehr geehrte Damen und Herren” THEN anredetxt := ‘Sehr geehrte Damen und Herren’; IF anrede = anrede::“Sehr geehrter Herr” THEN anredetxt := ‘Sehr geehrter Herr’; IF anrede = anrede::“Sehr geehrte Frau” THEN anredetxt := ‘Sehr geehrte Frau’; END; Betreff := Projektname; “!body2” := anredetxt + ’ ’ + “primäre Kontaktperson”; outlookaufruf.outlook(EmailEnd,Betreff,"!body2"); END ELSE MESSAGE(‘Keine Email Adresse der primären KP vorhanden !’); Maybe that helps. Christian

Hi Christian. This error usually occurs when there is a mis match in Data types or Overflow in the String sizes being assigned as mentioned by Joerg. Check the Field Lenght and Field Types for the following Variables * anrede := tmp_emailend.Anredewahl; - Both Should be of the same type and Length * anredetxt - if the lenght of this Variable is less then increase it by 10 more * Betreff := Projektname; - Both Should be of the same type and Length * “!body2” - This variable should definately by more than the Variables being concatenated and assigned so increase the length of this one since i dont understand much of your language i have mentioned all the Variables that are being assigned but just a guess this error is being cause by (anrede) variable. I hope this helps NGP/NCSD

Hi again! Use the debugger to find out the exact line where the error occurs: Extras - Debugger - Active (Yes) Extras - Debugger - Breakpoint (No) Then run the code, the debugger will stop at the line that “produces” the error. Check the length of all text/code variables that are used.

quote:


… IF anrede = anrede::“Sehr geehrte Damen und Herren” THEN anredetxt := ‘Sehr geehrte Damen und Herren’; IF anrede = anrede::“Sehr geehrter Herr” THEN anredetxt := ‘Sehr geehrter Herr’; IF anrede = anrede::“Sehr geehrte Frau” THEN anredetxt := ‘Sehr geehrte Frau’; …


This is not necessary. Better would be:


...
anredetxt := FORMAT(anrede);
...

quote:


… “!body2” := anredetxt + ’ ’ + “primäre Kontaktperson”; …


Better:


...
"!body2" := STRSUBSTNO('%1 %2', anredetxt, "primäre Kontaktperson");
...

quote:


outlookaufruf.outlook(EmailEnd,Betreff,“!body2”);


This is not a NAVISION-Standard function. You could use the standard with CU 397:


Globals or Locals
...
Variable "Mail", DataType "Codeunit", SubType 397

...
Mail.NeuMitteilung(<ZuName>,<CCName>,Betreff,"!body2",<DateiNameAnhängen>,<ÖffneDialog>);
...

is email-adress of the adressed is email-adress of cc-adressed <DateiNameAnhängen> is path/name of an attached file <ÖffneDialog> is to show or not the email-dialog This would call the clients standard-email programm. Regards, Jörg Joerg A. Stryk Apollo-Optik, IT/ERP Edited by - stryk on 2001 Nov 21 13:12:49

Thx everybody, it´s working. I used the Navision codeunit to do the job. But there´s still one little problem : If I decide not to send this e-mail an just close it Navision will give me an error. “User cancelled process” Any hint how to get rid of it ? But thanks again, response time is gigantic :wink: Christian Rettig Cycos AG

Then You need to do your own ocx. That error message does not come from Navision, but from the ocx. On the other note, I try to awoid that message by doing this:


textVariable := copystr(AnnotherVariable,1,maxstrlen(textVariable));

This will make sure, that I don’t get the owerflow error message. //Henrik Helgesen -: KISS::Keep it Simple, Stupid :-