Using the Attain Functionality, you can send a shortcut or a link by email. This is all well and good if you want to do it manually, but has anyone found a way to do this when creating a mail from a trigger. For example: I am using the mail c/u (397) and sending mails to a specific department when an event happens - this works fine and I have no problems so far. What I now need to do is to recreate the link by way of the “file attach”. So I have found that the command “CONTEXTURL” gives me the database, but how do I specify the target form and filters ?? Any Suggestions ??
Check out the Below Code: AttachmentText := STRSUBSTNO(’[InternetShortcut] %1 URL=%2&target=Form %3&view=SORTING(No.)&position=No.=CONST(%4)’,CRLF,CONTEXTURL,FormNum,“No.”); Attachname := STRSUBSTNO(‘c:%1 Requisition.url’,“No.”); Attachfile.CREATE(Attachname); Attachfile.WRITE(AttachmentText); Attachfile.CLOSE; Mail.NewMessage(Email, ‘’, Subject, Body, Attachname, TRUE); Where “Mail” is Codeunit 397 “Attachfile” is variable type File CRLF is a text variable representing the Newline character FormNum is the Form ID you want to appear “No.” is the current Rec (where you want the form positioned) and “Email”,“Subject”,“Body”,“Attachname” are all text variables. This does leave a file on your system, but you could put it in a temporary directory(check out the path returned by the command ENVIRON(‘TEMP’)) or delete the file after use using the ERASE(Attachname) command. With the latter you might need to ensure the mail is sent first. Nikolai L’Estrange Developer Ernst & Young New Zealand.
Many Thanks Nikolai, I have used your suggestion and found that I could make following amendments to the code: Attachmenttext:=STRSUBSTNO(’[InternetShortcut] %1%2 URL=%3’,CR,LF,CurrForm.URL); Currform.URL gives me the current record and the current form. I need to make one further modification, and that is to have multiple attachments. Is there a seperator that can be used or would I need to use some kind of repeat “function” to call the attchments ??
Thanks for the ‘CurrForm.URL’ tip! Check out the topic named: " Speaking of Mail - How do I create two attachments " in this forum for more info on attachments. I think basically you have to work out the structure of your MAPI OCX and write a new function for it (based on the one already in the Mail Codeunit). Nikolai L’Estrange Developer Ernst & Young New Zealand.
Nikolai, I was hoping that these words were not going to be mentioned - ‘Create new function’ , but I thought this was going to be my only soultion. Many Thanks and I will post any further tips that I find
Hi, Two attachments. Can anybody please post the code required to change codeunit 397 to have a function to send 2 attachments ? Thanks in advance
Is this the only way of doing a shortcut via MAPI ? Why do i ask, because at our customer site they have restrictions on the mails and *.url files arn’t allowed. Now you have in outlook a function called insert hyperlink, where if done, you get a hyperlink text in the message (it looks like that if you enter pe …deleted) Is there someone who figured out the code to insert this hyperlink directly into the mail body ???
Hey Benny, I’m not sure what that link was, but it did some nasty things related to Verisign, so I deleted it. If you find the correct link, go back and edit it.