I want to use the value returned by app.getPath("user") in order to enable some functionality on a form created using LiveCyle. The functionality to be enabled is a Save As option using the following code I found on this forum and which, by the way, works great:
//Code contained in .js file on users machine
//DateTime function
function myDateString()
{
return util.printd("yyyymmdd_HHMMss", new Date());
}
// SaveAs Function
var mySaveDoc = app.trustedFunction(function(doc) {
app.beginPriv();
var myPath = app.getPath("user", "documents") + myDateString() + ".pdf";
// saveAs is the only privileged code that needs to be enclosed with beginPriv/endPriv
doc.saveAs(myPath);
app.endPriv();
});
A button on the form contains
event.target.mySaveDoc(event.target);
which initiates the save as and works perferctly.
However, I want this button to be available only when a certain user is viewing the PDF. I can determine from the app.getPath() function who the user is. My question is how can I get the result from app.getPath() into a variable which I can then parse for the info I need? This should be simple since it is being collected in the above code but I can not figure out how to get it into a variable I can look at.
Thanks,
Ron
This field can be set to invisible so the users won't know about, but you can use its value for other functions.
Put this script in the form:ready event of the form field to call the function from the folder level script.
event.target.TrustMe(event.target);
radzmar
• LoveCycle Blog
Documents you need:
• LiveCycle Designer ES2 Docs