?
Solved

LS Send e-mail with doclink parent

Posted on 2003-12-02
7
Medium Priority
?
354 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 19

Accepted Solution

by:
madheeswar earned 2000 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

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

For Desktop Techs: How to retain a user's Notes configuration data when swapping out the end user's computer. (Assuming that you are not upgrading to a completely different version of Notes client) All you need to do is: 1) install Notes o…
This is an old article, please see an updated version of this article, located here: http://www.experts-exchange.com/articles/23619/Notes-8-5x-Windows-7-Notes-info-and-tips.html
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses

764 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