cancel
Showing results for 
Search instead for 
Did you mean: 

Attaching CSV file

former_member198652
Active Participant
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

jaisuryan
Active Contributor
0 Kudos

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

former_member198652
Active Participant
0 Kudos

Hi Surya,

Thankyou for your response.

Actually I already generated the flat file.

Now can you help me how to do in the toIDS pass to include this file.

that is where we have to give the path of the file, in ids pass.

Regards,

Jay

jaisuryan
Active Contributor
0 Kudos

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

former_member198652
Active Participant
0 Kudos

Hi Jai,

Here is my screen shot.

Can you please suggest me how to include the attachment which is I placed in Desktop.

Regards,

Jay

jaisuryan
Active Contributor
0 Kudos

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

former_member198652
Active Participant
0 Kudos

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
(-1)

Warning

Constant MAIL_SMTP_PORT was not defined in the repository
(-1)

Warning

Constant MAIL_ORIGINATOR was not defined in the repository (-1)

Warning

Constant MAIL_DEBUG was not defined in the repository
(-1)

Warning

Constant MAIL_DEBUG_RECIPIENTS was not defined in the repository
(-1)

Warning

Constant MAIL_TEMPLATE_FOLDER was not defined in the repository (0)

jaisuryan
Active Contributor
0 Kudos

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

former_member198652
Active Participant
0 Kudos

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

jaisuryan
Active Contributor
0 Kudos

Hi Jaya,

Did you try placing the file in IDM server? I would suggest to place the file in IDM working directory so we are sure that service user has access to read the file.

Kind regards,

Jai

former_member198652
Active Participant
0 Kudos

Hi Jai,

I didnt understand, IDM working directory.

Is it not possible to sent the file which is placed on desktop.

Regards,

Jaya

jaisuryan
Active Contributor
0 Kudos

Hi Jaya,

No, not from your local machine. It has to be in your IDM server machine.

Kind regards,

Jai

Ckumar
Contributor
0 Kudos

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

former_member198652
Active Participant
0 Kudos

Hi Kumar,

Thank you very much, our issue resloved.

Regards,

Jaya

Answers (0)