Installing a Package on ACC with the InstallPackage xtkBuilder method

Avatar

Avatar

sarrankanp50398

Avatar

sarrankanp50398

sarrankanp50398

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

wodnicki

MVP

Avatar

wodnicki

MVP

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

InMo

Avatar

InMo

InMo

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

Milan_Vucetic

MVP

Avatar

Milan_Vucetic

MVP

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