Hi,
Can anybody help me how to save a file (xml document) serverside(trigger) to directory in network?
working with Privatecloud V 4.1.1.0
Regards Jorrit
Hi Jorrit,
Can you try below code:
var url=new Packages.java.net.URL("{!link#url}");
var inputStream=url.openStream();
var br=new Packages.java.io.BufferedReader(new Packages.java.io.InputStreamReader(inputStream));
var stre;
var pw=new Packages.java.io.PrintWriter("D://two.txt");
while((stre=br.readLine())!=null){
pw.println(stre);
}
pw.close();
br.close();
inputStream.close();
Regards,
Shiva
Update.
I have the following code:
url=new Packages.java.net.URL("{!file#url}");
var inputStream=url.openStream();
how do i set the file using java.io packages to directory on the server?
Regards Jorrit
Hi Jorrit,
Can you try below code:
var url=new Packages.java.net.URL("{!link#url}");
var inputStream=url.openStream();
var br=new Packages.java.io.BufferedReader(new Packages.java.io.InputStreamReader(inputStream));
var stre;
var pw=new Packages.java.io.PrintWriter("D://two.txt");
while((stre=br.readLine())!=null){
pw.println(stre);
}
pw.close();
br.close();
inputStream.close();
Regards,
Shiva
Hi Shiva,
Its working!!! youre the best!
Regards Jorrit
Hi Shiva,
Can you please help me?
sinds 2 days my code isnt working anymore.
var v_url = "{!file#url}";
if(v_url !== ''){
var url=new Packages.java.net.URL(v_url);
on the row var url= i get the following error @ serverside tigger:
Server Returned Http Response Code: 500 For Url: somedomain.com/.../dialogerrorpage.jsp (line #17) in formula:
when i open the url in a browser where i logged in i can see the {!file} when i open the url in a browser with no login i get also the error
regards Jorrit
Hi Jorrit,
Did you make any changes to the code? If not can you debug the formula using "Debug Formula" available under object script trigger and copy the error message?
Regards,
Shiva
Hi Shiva,
I did not change this trigger.
error message:
Server Returned Http Response Code: 500 For Url: test-apps.profile.nl/.../dialogerrorpage.jsp (line #17) in formula:
regards Jorrit
Hi Jorrit,
Please create a support ticket we can do a quick screenshare session to debug the problem.
Regards,
Shiva
Hi Shiva,
The problem is view permissions on the object of role Portal Guest!
thats strange because its a serverside trigger i will create a Support ticket to see why the serverside trigger do nat have permissions for that object.
Regards Jorrit
Hi Jorrit,
As discussed over the call, please make the mark the checkbox in edit field(!file#url) of "file upload" ,since you want the file to be publicly accessible.
Regards,
Shiva