Email form report attachment  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

Email form report attachment

Postby Riyaz » Tue Jul 31, 2018 6:21 pm

Hi There

We have a requirement wherein we place an email button on the ribbon of the warehouse transfer out form which initiates the JiwaApplication.JiwaEmailUI.MainForm to send an email. We have written a plugin for this at the moment, which works fine, just wanted to know if we can attach a Jiwa Report to the email on the fly, so basically its a warehouse transfer report which gets generated depending on the tranfer no it originated from.

Thanks
Riyaz
Kohai
Kohai
 
Posts: 233
Joined: Wed Dec 02, 2015 2:05 pm
Topics Solved: 2

Re: Email form report attachment  Topic is solved

Postby Mike.Sheen » Tue Jul 31, 2018 6:25 pm

Riyaz wrote: just wanted to know if we can attach a Jiwa Report to the email on the fly, so basically its a warehouse transfer report which gets generated depending on the tranfer no it originated from.


Hi Riyaz,

Yes - the Email Message object has an attachments collection which is just our normal documents collection. You can add a report to that. For an example of how to generate a PDF and save it to disk, see this topic - you essentially want to do exactly that and then add the file to the Attachments property of the Email Message.

Mike
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2445
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 757

Re: Email form report attachment

Postby Riyaz » Tue Jul 31, 2018 6:47 pm

Hi Mike

Thanks for the quick reply, am sure that'll do the job, got a question though, can we save the PDF withing jiwa temp folders and then retrieve it, rather than a local drive path or network path.

Thanks
Riyaz
Riyaz
Kohai
Kohai
 
Posts: 233
Joined: Wed Dec 02, 2015 2:05 pm
Topics Solved: 2

Re: Email form report attachment

Postby Mike.Sheen » Tue Jul 31, 2018 7:21 pm

Riyaz wrote:can we save the PDF withing jiwa temp folders and then retrieve it, rather than a local drive path or network path.


Yes - the topic I linked shows how to do that in my first reply:

Code: Select all
     // export report to PDF
      string tempFolderPath = System.IO.Path.GetTempPath();
      string fileName = report.Title;

      // Make filename safe
      foreach (char c in System.IO.Path.GetInvalidFileNameChars())
      {
         fileName = fileName.Replace(c.ToString(), "");
      }

      string fullFileName = System.IO.Path.Combine(tempFolderPath, fileName) + ".pdf";


Mike
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2445
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 757


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 17 guests

cron