on 11-10-2014 10:22 AM
Dear Experts,
Can you please suggest how to add a csv(flat file) to send via email notification(to generic pass).
I already generated a flat file which needs to be send.
Regards,
Jaya
Hi Jaya,
one for the many ways to do was,
1) Create a job variable something like "Attachment" with value as full address of the file,
Eg: E:\TEST DRIVE\Attachment1.csv
2) Read that attachment into the script in to generic pass using uGetUserVar
Eg: var attachment1 = uGetUserVar ("ATTACHMENT", "Attachment is not included");
3) Include the variable in uSendSMTPMessage while sending the mail
Eg:
uSendSMTPMessage(Sender, Recipients, Subject, Message, SMTPHost, templateType, Port, attachment1);
If you create a file manually then you can skip 1st two steps and directly mention the full qualified file path for the attachement1 variable in your script. We use the above method because our file is automatically generated by IDM.
Kind regards,
Jai
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jaya,
I think you mean to generic pass.
How did you set up your notification task? Can you please post the screenshot of the destination tab?
Usually we use a script in a to generic pass where we initialize all the required parameters and call the user function uSendSMTPMessage with those parameters. You just need to mention the full path of the file in one of the variables in the script and include that in your parameter list of uSendSMTPMessage.
Kind regards,
Jai
Hi Jaya,
The file should be in your IDM server. Place the file anywhere in your server and copy the full path of the file, as said in above example: E:\TEST DRIVE\Attachment1.csv
Open your script 'Mail" and include the line
var attachment = "<path for the file in your server>";
Then locate the user function uSendSMTPMessage in your script and add attachment in the end of the parameters.
Run the job and check if you got the mail.
The help file for uSendSMTPMessage has explained clearly about how to use this user function.
if you need further help, then paste your 'Mail' script in your reply.
Kind regards,
Jai
Hi Jai,
Now am the job log throwing warning as below.
I defined those constants in Notification Repository,
Can you please help me how to correct it.
Regards,
Jaya
Constant MAIL_SMTP_HOST was not defined in the repository |
Warning | Constant MAIL_SMTP_PORT was not defined in the repository |
Warning | Constant MAIL_ORIGINATOR was not defined in the repository (-1) |
Warning | Constant MAIL_DEBUG was not defined in the repository |
Warning | Constant MAIL_DEBUG_RECIPIENTS was not defined in the repository |
Warning | Constant MAIL_TEMPLATE_FOLDER was not defined in the repository (0) |
Hi Jaya,
1) Please check if you have configured NOTIFICATION repository with these constants
2) Select repository tab of your pass and select the NOTIFICATION repository.
Btw, the question was how to set up notifications in IDM and not specifically limited to attachments?
If so, please check the documentation center if you can find any document related to this.
Further to that, you can check the below two posts on notification by our group members.
Don't forget SAP IDM has well structured help file for most of your technical queries.
Performing the initial configuration of the message templates
Hope these resources help.
Kind regards,
Jai
Message was edited by: Jai Suryan
Hi Jai,
I properly congiured the Notification Repository.
below is the simple script for attaching the file
function mail(Par){
var attachment="C:\Users\JKUMAR\Desktop\MAMissing.txt"
UserFunc.uSendSMTPMessage("noreply@abc.com",
"jaya@abc.com", "IDMDEVTEST_EMAILNOTIFICATION",+Subject,
"smtp.hostname",attachment);
}
for tha above notification,
am able to receive the mail but attachment is missing.
I mean it is attaching the files as AT00001.bin, and not the specified file.
As well as it is throwing warnings as already mentioned above.
Can you please suggest me how to attach the original file.
Regards,
Jaya
Nice post Suryan
Just a small modification, when i stored file path E:\TEST DRIVE\Attachment1.csv in a variable AttachmentPath, and passed this variable in uSendSMTPMessage function then it was throwing following error
ToGeneric.addEntry
org.mozilla.javascript.EvaluatorException: uSendSMTPMessage: Cannot read attached file.E:TEST DRIVEAttachment1.csv
Then i have stored file path as E:\\TEST DRIVE\\Attachment1.csv and now its sending the attachment.
Thanks & Regards,
C Kumar
User | Count |
---|---|
84 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.