Solved

LS Send e-mail with doclink parent

Posted on 2003-12-02
7
342 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
  • 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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
  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…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

758 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now