mibuso.com

Microsoft Business Solutions online community
It is currently Tue May 21, 2013 12:20 pm

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: How to create recordlink or notify by C/AL-Code
PostPosted: Fri Jan 08, 2010 1:00 pm 
Offline

Joined: Tue Mar 08, 2005 10:59 am
Posts: 39
Location: Egnach
Country: Switzerland (ch)
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

Code: Select all
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;

_________________
Roger


Top
 Profile  
 
 Post subject: Re: How to create recordlink or notify by C/AL-Code
PostPosted: Fri Jan 08, 2010 1:29 pm 
Offline
MVP Microsoft Dynamics NAV
NAV TechDays 2013 attendee

Joined: Tue Jul 19, 2005 4:49 pm
Posts: 3834
Location: Olst
Country: Netherlands (nl)
Thanks Roger!
:thumbsup:

_________________
Mark Brummel | Freelance Dynamics NAV (Navision) Developer
Author of the book : Microsoft Dynamics NAV 2009 Application Design

MY BLOG : http://www.brummelds.com


Top
 Profile E-mail WWW  
 
 Post subject: Re: How to create recordlink or notify by C/AL-Code
PostPosted: Sun Nov 07, 2010 6:14 pm 
Offline

Joined: Sun Nov 07, 2010 6:11 pm
Posts: 1
Country: Germany (de)
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

arnim


Top
 Profile E-mail  
 
 Post subject: Re: How to create recordlink or notify by C/AL-Code
PostPosted: Sun Nov 14, 2010 6:03 pm 
Offline

Joined: Thu Jun 15, 2006 10:59 pm
Posts: 42
Location: Miami
Country: United States (us)
arnim wrote:
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

arnim



Has anyone figured out how to import notes that are greater than 250 characters?
Thanks...


Top
 Profile  
 
 Post subject: Re: How to create recordlink or notify by C/AL-Code
PostPosted: Mon Nov 15, 2010 9:07 am 
Offline

Joined: Tue Mar 08, 2005 10:59 am
Posts: 39
Location: Egnach
Country: Switzerland (ch)
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 notes

Code: Select all
RecordLink.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 it

_________________
Roger


Top
 Profile  
 
 Post subject: Re: How to create recordlink or notify by C/AL-Code
PostPosted: Mon Nov 15, 2010 4:30 pm 
Offline

Joined: Thu Jun 15, 2006 10:59 pm
Posts: 42
Location: Miami
Country: United States (us)
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?


Top
 Profile  
 
 Post subject: Re: How to create recordlink or notify by C/AL-Code
PostPosted: Fri Feb 04, 2011 2:37 pm 
Offline

Joined: Sat Oct 17, 2009 11:37 am
Posts: 50
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 Char

Code: Select all
NoteLength := 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;


Top
 Profile E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum


Search for:
Jump to: