procedure FillNote() var Customer: Record Customer; RecordLink: Record "Record Link"; outStr: OutStream; MyInStream: InStream; begin Customer.GET('00000006'); Clear(RecordLink); RecordLink.Init(); RecordLink."Record ID" := Customer.RecordId(); RecordLink.Type := RecordLink.Type::Note; RecordLink."Link ID" := 0; RecordLink.Created := CurrentDateTime; RecordLink."User ID" := USERID; RecordLink.Company := CompanyName; RecordLink.Note.CreateOutStream(outStr, TextEncoding::UTF8); outStr.WRITETEXT('1111111111111 2222222222222 33333333333333 444444444444 555555'); if RecordLink.Insert(true) then Message('Si') else Message('No'); end;
procedure FillNote() var Customer: Record Customer; RecordLink: Record "Record Link"; outStr: OutStream; MyInStream: InStream; begin Customer.GET('00000006'); Clear(RecordLink); RecordLink.Init(); RecordLink."Record ID" := Customer.RecordId(); RecordLink.Type := RecordLink.Type::Note; RecordLink."Link ID" := 0; RecordLink.Created := CurrentDateTime; RecordLink."User ID" := USERID; RecordLink.Company := CompanyName; RecordLink.Note.CreateOutStream(outStr, TextEncoding::UTF8); outStr.WRITETEXT('AAA BBB CCC DDD EEE FFF'); if RecordLink.Insert(true) then Message('Si') else Message('No'); end;
Answers
function AddMemo(loc_rec : Record "Payment Lines";ApproveComment : Text[250])
SystemUTF8Encoder := SystemUTF8Encoder.UTF8Encoding;
SystemByteArray := SystemUTF8Encoder.GetBytes(ApproveComment);
RecLink.INIT;
RecLink.Type := RecLink.Type::Note;
RecLink.Created := CURRENTDATETIME;
RecLink."Record ID" := loc_rec.RECORDID;
RecLink.Description := ApproveComment;
IF MailAdressText <>'' THEN
RecLink."User ID":= GetUserByEmail(MailAdressText);
IF RecLink."User ID" = '' THEN
RecLink."User ID" := USERID;
RecLink.Company := COMPANYNAME;
RecLink.CALCFIELDS(Note);
CLEAR(RecLink.Note);
RecLink.Note.CREATEOUTSTREAM(OutStr);
x := SystemByteArray.Length DIV 128;
IF x > 1 THEN
y := SystemByteArray.Length - 128 * (x - 1)
ELSE
y := SystemByteArray.Length;
c1 := y;
OutStr.WRITE(c1);
IF x > 0 THEN BEGIN
c2 := x;
OutStr.WRITE(c2);
END;
FOR i := 0 TO SystemByteArray.Length - 1 DO BEGIN
c1 := SystemByteArray.GetValue(i);
OutStr.WRITE(c1);
END;
RecLink.INSERT;
RecLink Record Record Link
OutStr OutStream
Encoding TextEncoding
x Integer
y Integer
i Integer
c1 Char
c2 Char
Instead of
you should use
TypeHelper is Codeunit 10 "Type Helper".
You can see an example of use in Codeunit 454.