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

Installing a Package on ACC with the InstallPackage xtkBuilder method

Avatar

Avatar
Level 1
sarrankanp50398
Level 1

Likes

0 likes

Total Posts

6 posts

Correct Reply

0 solutions
View profile

Avatar
Level 1
sarrankanp50398
Level 1

Likes

0 likes

Total Posts

6 posts

Correct Reply

0 solutions
View profile
sarrankanp50398
Level 1

30-05-2020

I have a package I want to import using the method below that is described in the API docs

 

var params =
  {builder:
    {package:
      { ... }
    }
  }

NLWS.xtkBuilder.InstallPackage(params)

If i have a package that was generated (let's say package.xml). How exactly do i pass it into this function to install the package without errors?

Currently I can install the package through Tools -> Advanced -> Import Package and it works.

Adobe Campaign Classic package packages

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Establish
MVP
wodnicki
MVP

Likes

959 likes

Total Posts

1,082 posts

Correct Reply

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

Avatar
Establish
MVP
wodnicki
MVP

Likes

959 likes

Total Posts

1,082 posts

Correct Reply

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

31-05-2020

Hi,

 

The correct structure is:

<pkgDesc>
  <package buildNumber=".." buildVersion="..">
    <entities/>
  </package>
</pkgDesc>

 

Thanks,

-Jon

Answers (2)

Answers (2)

Avatar

Avatar
Boost 5
Level 2
InMo
Level 2

Likes

8 likes

Total Posts

25 posts

Correct Reply

12 solutions
Top badges earned
Boost 5
Boost 3
Boost 1
Applaud 5
Affirm 5
View profile

Avatar
Boost 5
Level 2
InMo
Level 2

Likes

8 likes

Total Posts

25 posts

Correct Reply

12 solutions
Top badges earned
Boost 5
Boost 3
Boost 1
Applaud 5
Affirm 5
View profile
InMo
Level 2

02-06-2020

Hi @sarrankanp50398,

Steps:
1. Create a workflow
2. Save name of file(whole location) in a variable(like varFile)
3. In javascript activity, Read the file and save in a variable( you an use below code)

//read package file
var f = new File("varFile")
f.open("r", File.CODEPAGE_UTF8)
var readFile
var line
while( line = f.readln() )
readFile=readFile+line;
f.close()

 

var elementsToImport = <entities schema="xtk:srcSchema"/>;
elementsToImport.appendChild(readFile);
var wholePackage = <builder><package buildNumber="*">{elementsToImport}</package></builder>;
xtk.builder.InstallPackage(wholePackage);


Above code is just for reference, I haven't tested it, so you might need to make some changes.

Hope it will help.

Avatar

Avatar
Contributor
MVP
Milan_Vucetic
MVP

Likes

166 likes

Total Posts

383 posts

Correct Reply

135 solutions
Top badges earned
Contributor
Springboard
Shape 1
Validate 25
Validate 10
View profile

Avatar
Contributor
MVP
Milan_Vucetic
MVP

Likes

166 likes

Total Posts

383 posts

Correct Reply

135 solutions
Top badges earned
Contributor
Springboard
Shape 1
Validate 25
Validate 10
View profile
Milan_Vucetic
MVP

31-05-2020

Hi @sarrankanp50398 ,

you may do it on this way:

  1. Convert XML package to JSON (open XML package with text editor, copy content and convert it to JSON via online converters)
  2. Add content to mentioned method and execute it in Java Script node.

Below is example how to import one dummy workflow package (consist of start and end node only) on my test environment.

var params = { "builder": {"package": {"entities": {"workflow": {"activities": {"start": {"transitions": {"initial": { "name": "initial","target": "end"}},"label": "Start","name": "start","x": "117","y": "2510"},"end": {"label": "End","name": "end","x": "257","y": "2509"}},"scenario": {"operation": "none","internalName": "notifySupervisor"},"desc": "Empty template to create a new workflow","folder": {"operation": "none","name": "sunFolder221"},"form": "xtk:workflow","internalName": "WKF4660","label": "test","modelName": "newWorkflow","scenario-cs": "Notification of the workflow supervisor (notifySupervisor)","schema": "nms:recipient"},"schema": "xtk:workflow"},"author": "Milan Vucetic (vucetic)","buildDate": "2020-05-31 17:22:54.563Z","buildNumber": "8981","buildVersion": "6.7"} } }
NLWS.xtkBuilder.InstallPackage(params);

 

Of course, you should explore options how to automate this.

 

Regards,

Milan