PeopleSoft General Discussion
Email with XML Publisher
Hello There, I'm fairly new with the XML publisher, so go easy on me. I'm able to create the report and run it. It goes to the report manager and all is good. I'm reading peoplebooks to use XML publisher in a programmatic way and would like to know if there is a way that I can trigger the creation of a report through XML publisher and then have the file emailed as an attachment to a list of user. Any comment would be appreciated. Thank you, Giovanni
Hi Giovanni, The way we did it, was to have 2 AE's in a Job. The first one to create the report and the second one to email reports to individual users. Thank You Prashant
Thanks for the reply Prashant. I did a similar thing and seems to work ok. Just having some trouble with a command line. But that's another topic.
My client wanted something similar to what you are requesting. The delivered Schedule Query distribution was kinda lacking in that it would send a link to the list of people instead of sending them the actual query results in a file (pdf, excel, html format available). I created a Query Scheduler where a user could email the actual file to the users inbox instead of a link. This has proven to be useful for people that just need a report and do not necessarily need access to PeopleSoft. Where I use XML Publisher is on a push button to create the page into a PDF. I could probably send an email if so desired. :0) I would think you could do all this in one AE as I do with my Schedule Query app. Here is the code I used. Here is the code, let me know if this helps. /** Before here you would have your Query code........then you would invoke the email App package **/ Local PT_MCF_MAIL:MCFOutboundEmail &email = create PT_MCF_MAIL:MCFOutboundEmail(); &FromAddress = "email@example.com"; /* &ToList = "firstname.lastname@example.org,email@example.com"; */ &email.From = &FromAddress; &email.Recipients = &sEmailList; &email.Subject = &sEmailSubject; Local PT_MCF_MAIL:MCFBodyPart &text = create PT_MCF_MAIL:MCFBodyPart(); &text.Text = &sEmailBody; Local PT_MCF_MAIL:MCFBodyPart &attachFile = create PT_MCF_MAIL:MCFBodyPart(); &attachFile.SetAttachmentContent(&sOutputGetFilePath, %FilePath_Absolute, &sOutputAttachFileName, " ", "", ""); Local PT_MCF_MAIL:MCFMultipart &mp = create PT_MCF_MAIL:MCFMultipart(); &mp.AddBodyPart(&text); &mp.AddBodyPart(&attachFile); &email.MultiPart = ∓ &email.ContentType = "text/html"; Local integer &res = &email.Send(); Local boolean &done; Evaluate &resp When %ObEmail_Delivered /* every thing ok */ &done = True; Break; When %ObEmail_NotDelivered /*-- Check &email.InvalidAddresses, &email.ValidSentAddresses and &email.ValidUnsentAddresses */ &done = False; Break; When %ObEmail_PartiallyDelivered /* Check &email.InvalidAddresses, &email.ValidSentAddresses and &email.ValidUnsentAddresses; */ &done = True; Break; When %ObEmail_FailedBeforeSending /* Get the Message Set Number, message number; Or just get the formatted messages from &email.ErrorDescription, &email.ErrorDetails;*/ &done = False; Break; End-Evaluate; &oQuery.Close(); /*** Close Query Object ***/ End-If; Edited by: user10401702 on Oct 31, 2008 11:12 AM
Just wanted to respond to this thread again. My company is now using this functionality in production and is working very well. I created a scheduling query tool that allows reports to be emailed to a specific user or distribution list. Let me know if you need any assistance with this. -Trace
Hi Trace, I have a similar requirement of sending reports as a email attachment... I looked at the code that u have specified and have tried to implement it... but the email is not getting generated' in my case... I think the problem is due to the parameters that we need to pass thru the SetAttachmentContent() method... I would be of great help if u can provide some insight on the method... currently I am trying publish the report with the following syntax... &oRptDefn.Publish("", "", "", PROCESS_INSTANCE value); I tried to modify this by adding the destination as this is possibly one of the parameters we are required to pass in the SetAttachmentContent() method and it looks like, &oRptDefn.Publish(%FilePath, "", "", SSF_INVP_AET.PROCESS_INSTANCE); the parameters that I am trying to pass in the method are, &attach.SetAttachmentContent(&sOutputGetFilePath, %FilePath_Absolute, "SSF_PRNT_INV.pdf", " ", "", ""); any suggestions would be of great help... Thanks... chandan