Solved

LS Send e-mail with doclink parent

Posted on 2003-12-02
7
353 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

You’ve got a lotus Domino web server, and you have been told that “leverage browser caching” is a must do. This means that we have to tell the browser everywhere in the web to use cache. In other words, we set (and send) an expiration date in the HT…
Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

707 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