How to create recordlink or notify by C/AL-Code

Roger
Member Posts: 57
If you want to create a notify message which is shown on the start page of a role center you can
use the following example.
It is importent to set the lenght of the text in a CHAR variable in front of the text.
Define the following variables in the locals of the function:
OutStream DataType OutStream
Text DataType Text 250
NewID DataType Integer
LenChar DataType Char
use the following example.
It is importent to set the lenght of the text in a CHAR variable in front of the text.
Define the following variables in the locals of the function:
OutStream DataType OutStream
Text DataType Text 250
NewID DataType Integer
LenChar DataType Char
Text := 'Dies ist ein weiterer wertvoller Hinweis'; LenChar := STRLEN(Text); Text := FORMAT(LenChar) + Text; Cont.GET('1000'); NewID := Cont.ADDLINK('dynamicsnav://dell-rotsch:7046/myCharity/myCharity/runpage?page=5050&mode=Edit', 'Über eigene Funktion erstellt'); RecordLink.GET(NewID); RecordLink.CALCFIELDS(Note); RecordLink.Note.CREATEOUTSTREAM(OutStream); OutStream.WRITE(Text); RecordLink.Type := RecordLink.Type::Note; RecordLink.Notify := TRUE; RecordLink."To User ID" := USERID; RecordLink.MODIFY;
Many thanks, Roger
0
Comments
-
-
Hello Roger,
do you have any idea how to post more the 250 digits in a note? Because a char can have as max value 250.
Thanks in advance
arnim0 -
arnim wrote:do you have any idea how to post more the 250 digits in a note? Because a char can have as max value 250.
I've used the following code for creating notesRecordLink.CALCFIELDS(Note); RecordLink.Note.CREATEOUTSTREAM(OStream); OStream.WRITE(FORMAT(LenChar) + _Note); RecordLink.Type := RecordLink.Type::Note; RecordLink.Notify := _Notify; RecordLink."To User ID" := _UserID; RecordLink.MODIFY;
The variabale _Note is a text variable which have a length of 1024.
I mean, you should be able to add more of such variable using the +
I've not tested itMany thanks, Roger0 -
Roger wrote:arnim wrote:do you have any idea how to post more the 250 digits in a note? Because a char can have as max value 250.
The variabale _Note is a text variable which have a length of 1024.
I mean, you should be able to add more of such variable using the +
I've not tested it
You get an error when assign LenChar to the length of the text string when LenChar is a char type variable.
Is there another way to assign the length?0 -
If your text is longer than 255 characters, you need to include a second Char. The formula is in this code...
TextToWriteAsNote Text 1024
NoteLength Integer
Char1 Char
Char2 CharNoteLength := STRLEN(TextToWriteAsNote); IF NoteLength <= 255 THEN BEGIN Char1 := NoteLength; Char2 := 1; END ELSE BEGIN Char1 := 128 + (NoteLength - 256) MOD 128; Char2 := 2 + (NoteLength - 256) DIV 128; END; TextToWriteAsNote := FORMAT(Char1) + FORMAT(Char2) + TextToWriteAsNote;
0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions