Emailing PDF report with single record

Emailing PDF report with single record

Hi,

I hope someone can help.

Firstly, I will explain what I have working, then describe what I can’t get to work.

Working functionality:

Find the last record entered by the logged in user, store the record ID, send a PDF version of all records in the view by email, and finally open the view with the single record in the same window.  The steps I’m following are:

  1. Enter data into my Creator form and click submit.
  2. On successful update to the DB, call the below function (MentorProgramme.MentorProgramme).
  3. Find the appropriate record ID of the last row entered by the logged in user.
  4. Send an email with the PDF view containing all the records.
  5. Display view with the single record showing.

  void MentorProgramme.MentorProgramme()

{

    if (Mentoring_Session_Report[Mentor_Login_Details == zoho.loginuserid].count()  >  0)

    {

        requiredRecord  =  Mentoring_Session_Report  [Mentor_Login_Details == zoho.loginuserid] sort by  Modified_Time desc range from 1 to 1;

        thisID = requiredRecord.ID;

         sendmail

        (

            To       :  "mark@gmail.com"

            From     :  zoho.adminuserid

            Subject  :  "test5"

            Message  :  "Your message"

            Attachments : view:Mentoring_Session_Report_Report as PDF

        )

        openUrl("#View:Mentoring_Session_Report_Report?ID=" + thisID, "same window");

    }

}

The above steps and function all work as expected.


Additional functionality I cannot get to work:

Same as above, although this time the PDF should only contain the single row matching the record ID found.  In other words I need the PDF and the final view to display the single found record.   I have tried to modify the

       ‘Attachments : view:Mentoring_Session_Report_Report as PDF’

line of code to something similar to 

       openUrl("#View:Mentoring_Session_Report_Report?ID=" + thisID, "same window")

without any success.  Can anyone help?

Thanks

Mark