How can we store the attachment which is in the external url in the form of (WORK-ATTCH-URL) into our local server directory?
I have a requirement in whcih i have to download attachment which attached as a URL in email. In the blob of URL i can get the url and if i copy the url in browser then i can to download the attachment but i need to copy that attachment from url into my local server directory.
Basically i want all the attachemnt which is attached as a URL(Work-Attach-URL) in my local server dirctory.If anybody can help to about what approach i follow for this then it would be very helpful
***Updated by Moderator: Lochan. Removed user added #helpme, FAQ and Ask the Expert tags. Apologies for confusion, shouldn't have been an end-user option; updated Categories***
I am a bit confused about the actual requirement. You have an email, but is that incoming to Pega or outgoing from Pega, or in your email client? Later you state the URL is attached in a Work-Attach-URL? Does this mean we can ignore the email component of your requirement?
Loading a URL is quite complicated requirement for the general case. Since the web is dynamic, for example if your URL was http://tycho.usno.navy.mil/simpletime.html which displays the current time is an extreme example, or if your web page contains dynamic flash content. Additionally URL's may return different things depending on authentication, etc. Do you expect these complicated scenarios or are your URL's always simple cases?
Can you give us more specifics about your what your URL describes, that would simplify the problem?
If you need to download a (single, binary ?) file from a URI then store that binary file as a PRPC attachment; you can try the following.
It uses a HTTP-CONNECT rule to fetch the file; maps the result to a PRPC Property of type 'Java' (java.lang.Object); then uses the Code-Pega-PDF.AttachToWork Activity to attach to an (already-existing) Work Object.
I haven't tried files other than PDF here - and it may be you have to create a modified version of 'AttachToWork' to do this. (Or perhaps there is already an OOTB Activity for general attachments ?).
Here's the setup I used:
1. Create a Java Property 'BinaryData':
2. Create a CONNECT HTTP Rule; no need to fill in Endpoint or Resource Path (we'll do that when we call it), but we will fill in the 'Response Tab':
3. Create an Activity to call the HTTP CONNECT Rule, and then call AttachToWork:
Now run the Activity:
And then check the Work Item ("T-15") in my case:
And finally: view the attachment; to make sure it worked.