Hi,
Want to know if we can create the packages from the Workflows. I know there is a standard document available :-
https://helpx.adobe.com/campaign/kb/export-packages-automatically.html
But need more inputs on how the code works and how can I use the code.
Thanks,
Adithya
Solved! Go to Solution.
Views
Replies
Total Likes
Hello,
Here is an example of JS code that generate a package as XML File :
var packageName = "myPackage";
//export delivery with internalName 'DM123456'
var schema = "nms:delivery";
var conditionExpression = "@internalName = 'DM123456'";
specFileDef = {
specFile : {
definition : {
schema : schema,
where : {
condition : [{
"expr" : conditionExpression
}]
}
}
}
};
var specFile = NLWS.xtkSpecFile.create( specFileDef );
//Package generation
var package = specFile.GenerateDoc();
//Save content in a file
var packageBuffer = new MemoryBuffer();
packageBuffer.fromString ( package.toXMLString() );
//File name with date included :
packageBuffer.save( packageName + "_" + formatDate( new Date(), "%4y%2M%2D") + ".xml" );
The package will be the same as if you export with the console.
Cedric
Hi,
Use a js activity with the code from that doc page.
Here's a simplified example from a library I wrote once that managed packaging and vcs:
var selectionExport = xtk.specFile.exportSelection(schema, <where>
<condition expr={condition}/>
</where>);
var f = new File(filepath);
f.open('w');
f.writeln('<package buildNumber="' + buildNumber + '" buildVersion="' + buildVersion + '">');
f.writeln(selectionExport.entities.toXMLString());
f.writeln('</package>');
f.close();
The exportSelection() endpoint is in xtk:package.js btw if you want to see how it works.
Thanks,
-Jon
Views
Replies
Total Likes
Views
Replies
Total Likes
Hello,
Here is an example of JS code that generate a package as XML File :
var packageName = "myPackage";
//export delivery with internalName 'DM123456'
var schema = "nms:delivery";
var conditionExpression = "@internalName = 'DM123456'";
specFileDef = {
specFile : {
definition : {
schema : schema,
where : {
condition : [{
"expr" : conditionExpression
}]
}
}
}
};
var specFile = NLWS.xtkSpecFile.create( specFileDef );
//Package generation
var package = specFile.GenerateDoc();
//Save content in a file
var packageBuffer = new MemoryBuffer();
packageBuffer.fromString ( package.toXMLString() );
//File name with date included :
packageBuffer.save( packageName + "_" + formatDate( new Date(), "%4y%2M%2D") + ".xml" );
The package will be the same as if you export with the console.
Cedric
Views
Replies
Total Likes