Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Package creation from Workflow

Avatar

Avatar
Affirm 5
Level 3
adithyacs86
Level 3

Likes

22 likes

Total Posts

110 posts

Correct Reply

5 solutions
Top badges earned
Affirm 5
Validate 10
Validate 1
Give Back 5
Give Back 3
View profile

Avatar
Affirm 5
Level 3
adithyacs86
Level 3

Likes

22 likes

Total Posts

110 posts

Correct Reply

5 solutions
Top badges earned
Affirm 5
Validate 10
Validate 1
Give Back 5
Give Back 3
View profile
adithyacs86
Level 3

03-05-2021

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

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Boost 10
Level 3
CedricRey
Level 3

Likes

24 likes

Total Posts

65 posts

Correct Reply

12 solutions
Top badges earned
Boost 10
Applaud 5
Boost 5
Affirm 5
Give Back
View profile

Avatar
Boost 10
Level 3
CedricRey
Level 3

Likes

24 likes

Total Posts

65 posts

Correct Reply

12 solutions
Top badges earned
Boost 10
Applaud 5
Boost 5
Affirm 5
Give Back
View profile
CedricRey
Level 3

04-05-2021

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

Answers (1)

Answers (1)

Avatar

Avatar
Establish
MVP
wodnicki
MVP

Likes

961 likes

Total Posts

1,090 posts

Correct Reply

509 solutions
Top badges earned
Establish
Affirm 500
Contributor
Shape 1
Give Back 100
View profile

Avatar
Establish
MVP
wodnicki
MVP

Likes

961 likes

Total Posts

1,090 posts

Correct Reply

509 solutions
Top badges earned
Establish
Affirm 500
Contributor
Shape 1
Give Back 100
View profile
wodnicki
MVP

03-05-2021

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