cancel
Showing results for 
Search instead for 
Did you mean: 

Retrieving the contract document(word document) as a filestream in a script

Former Member
0 Kudos

Hi

We have a requirement to send the contract document(Microsoft word document) as an attachment in a custom email. We have to do this through scripting. I am able to send a mail with attachement. However I am unable to send the word document successfully. This is because I am unable to fetch a file stream of the word document. The Approach I am using is as follows.

1) Retrieve the contract document as an object of AttachmentIfc

2) Use the attachementIfc object to get the servlet download link(relative URL)

3) Build the complete URL, from the base servlet URL

4) Create an object of URL class by supplying the URL created above

5) Use this URL object to create a connection and retrieve the resource at the end of the URL as a filestream.

I am able to receive the word document through the mail. However the document contains an error page with the message u201CYour session is no longer valid Please log into the applicationu201D

My understanding is a new session was created and hence the error page was retrieved instead of the document. How do I avoid creating a new session or how do I retrieve the parameters of the existing session in order to open the URL in the same session. Is there a way I can use the session id to maintain the current session?

Please let me know if this can be done or if there is an alternative method to retrieve the document?

Your inputs are highly appreciated.

Thanks and Regards,

Immanuel

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Solved.

I used an alternative approach to fetch it from the DB directly.

Former Member
0 Kudos

Hi Immanuel,

How to access the database using the scripts in esourcing ? If we can access the database through scripts i feel that we would be able to add much more functionalities into it .

Thanks and Regards