Solved

LS Send e-mail with doclink parent

Posted on 2003-12-02
7
352 Views
Last Modified: 2013-12-18
Please I need your help.  I do not work with LS a lot.

1) The user is in a response form.
2) He sends an e-mail
3) The e-mail should have the link to the parent form not to the response form (which is the actual document the user is in)

Could you provide me with the LS to do this.  I think @SendEmail does not work because the IncludeDocLink includes the current ResponseForm Link.

Many thanks!

I am posting this question with 125 points but I promise 500 for a complete script, because I need it urgently.
0
Comment
Question by:Zopilote
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
7 Comments
 
LVL 19

Expert Comment

by:madheeswar
ID: 9864830
try this below logic:
Okay have a field in the main document and call it docid.
Make it Text-Computed with a formula @Text(@DocumentUniqueID).  Hide this field.

In the response document have a field called ParentDocumentRef and have it Text-Computed with a formula docid(the field name of the parent doc).

Have the response document docs form property to include the "Formulas inherit values from the selected doc".

After this the subform will have The parent doc unid in the field ParentDocRef field even before its saved.  Use this to access the parent doc.
Thanks to Arun
0
 
LVL 19

Expert Comment

by:madheeswar
ID: 9864833
Then we can have a document unique id with above logic and we can send parent document as link.

Is it Ok for u?

If it is ok, let me know so that I can provide LScript to send emails.
0
 
LVL 19

Expert Comment

by:madheeswar
ID: 9864847
Wait a minute, I will give complete solution in LScript.

No need to use above method.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 19

Accepted Solution

by:
madheeswar earned 500 total points
ID: 9864872
try below code and let me know:
Sub Click(Source As Button)
      Print "Submitting mail to approving person ..."
      Dim ws As New notesuiworkspace
      Dim uidoc As notesuidocument
      Dim doc As notesdocument
      Dim item As NotesItem
      Dim numvalues As Integer
      Dim session As New notessession
      Dim db As notesdatabase
      Dim maildoc As notesdocument
      Dim Body As NotesRichTextItem
      Dim hard As String
      
      Set db=session.currentdatabase
      Set uidoc=ws.currentdocument
      Set doc=uidoc.document
      tmpamount=Cstr(doc.grandtotal_n(0))
      
      Dim view As notesview
      Set view=db.getview("urviewname")
      Set parentDoc = view.GetParentDocument( doc )
      'SEND MAIL TO DEPT HEAD.
      
      Dim item1 As notesitem
      Set item1 =doc.getfirstitem("approver_x")
'      For y = 0 To Ubound(item1.values)
      Set maildoc = New NotesDocument( db )
      maildoc.Form = "Memo"
      '      If (uidoc.Fieldgettext("adjust_k")="Adjust Leave") Then
      maildoc.Subject ="New Payment Voucher Request"
      Set Body=New NotesRichTextItem(maildoc,"Body")
      message="Please check the items requested to this month for our department for the amount "+tmpamount+" and take necessary action. Thank you."
      '      Else
      '            maildoc.Subject = _
      '            "Leave Application"
      '            Set Body=New NotesRichTextItem(maildoc,"Body")
      '            message="Please review my leave application for "+tmpamount+" days. Thank you."
      '      End If
      
      Call Body.AppendText(message)
      Call Body.AddNewLine(2)
      message1="Click here to open the form=========>>"
      Call Body.AppendText(message1)
      Call Body.AppendDocLink(parentdoc,"Please click this link to open the document")
      Call Body.AddNewLine(2)
      mess="(This is an auto-generated email. You may delete this after review.)"
      Call Body.AppendText(mess)
      For y = 0 To Ubound(item1.values)
            hard=item1.values(y)+"@stoneforest.com.sg"
            Print "Submitted to : "+item1.values(y)
            
            Call maildoc.Send( True, hard)
      Next
      
      
      
End Sub
0
 
LVL 19

Expert Comment

by:madheeswar
ID: 9864903
first u need to save the currentdcoument and refresh view and then use this code.
0
 
LVL 5

Author Comment

by:Zopilote
ID: 9865050
Madhesswar,
Many thanks to you (and Arun)

The script worked as:

Sub Click(Source As Button)
      Print "Submitting mail..."
      Dim ws As New notesuiworkspace
      Dim uidoc As notesuidocument
      Dim doc As notesdocument
      Dim parentDoc As NotesDocument
      Dim session As New notessession
      Dim db As notesdatabase
      
      Dim maildoc As notesdocument
      Dim Body As NotesRichTextItem
      
      Dim item1 As notesitem
      Dim item As NotesItem
      Dim Recipient As String
      
      Set db=session.currentdatabase
      Set uidoc=ws.currentdocument
      Set doc=uidoc.document
      Set parentDoc = GetParentDocument( doc)
      
      Set maildoc = New NotesDocument(db)
      Set Body=New NotesRichTextItem(maildoc,"Body")
      
      maildoc.Form = "Memo"
      maildoc.Subject ="New Payment Voucher Request"
      
      Recipient= "TestUser"
      message="Hello World"
      message1="Click here to open the form=========>>"
      mess="(This is an auto-generated email. You may delete this after review.)"
      
      Call Body.AppendText(message)
      Call Body.AddNewLine(2)
      Call Body.AppendText(message1)
      Call Body.AppendDocLink(parentDoc ,"Please click this link to open the document")
      Call Body.AddNewLine(2)
      Call Body.AppendText(mess)
      
      Call maildoc.Send( False, Recipient )
      
End Sub

Function GetParentDocument( doc As NotesDocument )
      Dim db As NotesDatabase
      Dim parentDoc As NotesDocument
      Set db = doc.ParentDatabase
      If doc.IsResponse Then
            Set parentDoc = db.GetDocumentByUNID _
            ( doc.ParentDocumentUNID )
      End If
      Set GetParentDocument = parentDoc
End Function

I thank you again for your prompt answer. I am increasing the points and then accepting your answer.

Merci beaucoup!

Z;D
0
 
LVL 19

Expert Comment

by:madheeswar
ID: 9865052
Ok. Ur welcome
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Lotus Notes 8.0 Forward emails for 30 days. 8 124
Invoke VBA from lotusscript after mailmerge 11 250
Lotus Notes 8.5 1 167
IBM SAN DS 3512 Controllers Networking issues 11 75
  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
Article by: Rob
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question