Hi Jason,
Thank you for the overview. I was doing
something similar, but it involved a cgi script
that was hard to maintain, only worked on the
mid-tier, and created a security hole. This is much better.
By the way, you can put a login id and encrypted
password in the macro (just record yourself
logging in, then add those two lines to your
macros). Then you just have to make sure the
users can't request reports for any data they are
not allowed to see because you would lose the row
level security, but you wouldn't have to pass any login information.
Julie
At 01:19 AM 11/16/2007, you wrote:
**
Hi Julie,
I plan on putting together the files and a def
for anybody that wants to use it. This was done
as a proof of concept a while back for a
coworker and not something I am actively using.
I need to do a little bit of cleanup before I post it.
Here are the ingredients:
(FYI, this is on a Windows server and I use a
batch file. You will need to reengineer a bit
for Unix
but now that I think of it, there
isnt a runmacro for Unix, is there?)
1 Macro:
This holds the source form, query and exported file layout/details
1 Batch file:
Deletes the exported file once email has been sent
Two forms:
Form 1, a configuration form. It houses data
fields for the email subject, body, email
addresses and the filename of the attachment.
From 2, a distribution form that does the
emailing. A records is created each time a
report is sent out. They could be automatically
deleted but I like keeping them for tracking.
1 Escalation:
Runs off the Config form (form 1).
Does a Run Process calling runmacro and passes
the login credentials, port and filename info
(storing/passing login info is one weakness of this method)
Does a Push Fields to the distribution form to
create a record. Passes the To:, Subject, Body and file name fields
3 Filters (all run on submit):
FLTR 1, Grabs the file exported from the runmacro.
Runs If file name field is not null.
Does a Set Fields to Successful Run with $
PROCESS$ PERFORM-ACTION-ADD-ATTACHMENT 600017101
"C:\AttachedFiles\$File Name$.csv"
FLTR 2, Emails the file.
Runs If status is new and attachment field is not null.
Does a Notify action using fields populated in the escalation Push Fields
Does a Set Fields status = sent
FLTR 3, deletes the export file on hard drive,
Runs If status = sent and attachment field is
not null and Successful Run field is null
(this an integer field that should be null if runmacro exited without error)
Does a Set Fields to Successful Run with a $
PROCESS$ C:\Batches\DeleteAttachment.bat $File
Name$ (will be set to 0 if batch exits without error)
All you need to do to trigger this off a button
is replace the escalation that does the Push
Fields with an active link. Ultimately there are
a number of variations that can to this for
instance the batch code (or script) could be
stored in the config record and eliminate the
need for the file. Also the exported file
cleanup could be done with a scheduled task or
cron job but I wanted to cut down on the likely
hood of the same file being sent twice so I
delete it almost instantly. If you are doing
this with an AL you may want to make sure the
file name is unique (you could use a GUID ;-)
One thing that I noticed tonight when I fired
this up again (I havent used it since March)
was that the email body included AttPL01_Fld01
: SHR-ConsolList.csv (see attachment
<SHR-ConsolList.csv>). It is kind of ugly but
could be corrected with an HTML email template if necessary.
Jason
From: Action Request System discussion
list(ARSList) [mailto:[EMAIL PROTECTED] On Behalf Of Julie Rockwood
Sent: Thursday, November 15, 2007 11:45 AM
To: [email protected]
Subject: Re: E-mailing a Report (UNCLASSIFIED)
**
Jason,
>We built a process with 2 forms, 3 filters and
1 escalation that will send a CSV. Let me know
if this is what you are looking to do and I can give you more details.
Yes! Please send details to the
list. Especially if it's something that we can
modify to kick off from a button instead of an escalation.
Julie
__20060125_______________________This posting
was submitted with HTML in it___
-------------------------------------------------------
Julie Rockwood
Los Alamos National Laboratory
IST-APPS3 BMC Technical Lead
(505) 667-9846
_______________________________________________________________________________
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org
Platinum Sponsor: www.rmsportal.com ARSlist: "Where the Answers Are"