Hello All
I am trying to use the below referenced document to generate and download packages but with limited outcome.
I have created a workflow with the below snippet; the workflow runs without error but i see only a single line as output. More than that; i am unable to find a way to access any generated package files. Would prefer to either find a proper link to ftp them or just download them locally. The end goal is to ftp and upload in another environment.
var query = xtk.queryDef.create(
<queryDef schema="xtk:specFile" operation="select">
<select>
<node expr="@name"/>
<node expr="@namespace"/>
<node expr="data"/>
</select>
<where>
<condition expr="[@namespace] = 'XYZ'" />
</where>
</queryDef>
);
var res = query.ExecuteQuery();
var specFile = xtk.specFile.create(res);
var package = specFile.GenerateDoc();
var fileName = "/tmp/myPackage.xml"
saveXmlFile(package, fileName)
var file = new File("/tmp/myPackage.xml")
file.open()
for each(var line in file)
logInfo(line)
file.close()
The above highlighted segment gives me just a single line of result:
<?xml version='1.0' encoding='windows-1252'?>
Solved! Go to Solution.
Hello ankurm40172185
You have more options here:
1) zip the files and load them to any ftp
zip them by using execCommand() in JS activity
2) zip files and send them as computed attachment to an email
- Do not forget to pasword protect them
3) you can zip them and request file transfer job by whoever is managing the remote server
4) you can create web app where you run workflow and trigger download of the zip file
5) request remote access to the server
BR,
Marcel
Hello,
this is not the exact code you are using right?
Do you have data in res?
Marcel
Views
Replies
Total Likes
marcel.gent.86 This is almost the code i am using; i have package definitions created in a given namespace (used in the where clause). If I do a logInfo on res i can see the package defintion XML being logged in.
Views
Replies
Total Likes
Hello ankurm40172185
i got it
when you xkt.query you will have collection of specFiles <specFile-collection><specFile .../></specFile-collection>
Long story short you need to loop over this collection:
var query = xtk.queryDef.create(
<queryDef schema="xtk:specFile" operation="select">
<select>
<node expr="@name"/>
<node expr="@namespace"/>
<node expr="data"/>
</select>
</queryDef>
);
var res = query.ExecuteQuery();
logInfo("Exporting " + Object.keys(res).length + " packages");
var exported = 0;
for (var i = 0;i<Object.keys(res).length; i++){
try{
var specFile = xtk.specFile.create(res[i]);
var package = specFile.GenerateDoc();
var fileName = "/tmp/package_" + res[i].@name.toLowerCase() + ".xml";
saveXmlFile(package, fileName);
exported++;
}catch(err){
logWarning("Package " + res[i].@name + "has not been exported due to an error.");
}
}
logInfo("Exported " + exported + " out of " + Object.keys(res).length +" packages requested.");
Marcel
marcel.gent.86 Thanks; let me make the query restrictive to a single package and retry. I just want to try this for one record correctly first.
Views
Replies
Total Likes
marcel.gent.86 Thanks Marcel; you pointed in the right direction; however; as we use managed services I cannot access the files and the adobe documentation doesnt explain how/where to download/ftp this.
Views
Replies
Total Likes
Hello ankurm40172185
You have more options here:
1) zip the files and load them to any ftp
zip them by using execCommand() in JS activity
2) zip files and send them as computed attachment to an email
- Do not forget to pasword protect them
3) you can zip them and request file transfer job by whoever is managing the remote server
4) you can create web app where you run workflow and trigger download of the zip file
5) request remote access to the server
BR,
Marcel
Thanks; let me try this.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies