Scripts for company deployment

You can create an export script to select your objects and object types for company deployment by manually writing the script or through the Selective Export window in the user interface.

You must create scripts to deploy your company from either the command-line or the user interface. Create your deployment scripts to specify your objects and object types that you want to deploy from a source Product Master system to a destination system. You can use any combination of scripts, for example, you can specify to include all objects of a certain object type and only certain objects of another object type.

Use the following two example scripts to develop your deployment scripts. See Deployment script operations to view the descriptions for script operations in the scripts.

Scripts example to deploy object types with all the object type entities:
envObjList = new EnvObjectList();

envObjList.addAllObjectsToExport("CATALOG");
envObjList.addAllObjectsToExport("CATALOG_VIEW");
envObjList.addAllObjectsToExport("HIERARCHY_VIEW");
envObjList.addAllObjectsToExport("MAPS");
envObjList.addAllObjectsToExport("LOOKUP_TABLE");

ADD ADDITIONAL OBJECT TYPES HERE

sDocFilePath = "archives/mycompleteexport.zip";
exportEnv(envObjList, sDocFilePath);
If you want to specify the name mapping file, then you must add the optional mappingFilePath parameter. The following example code enable you to specify the optional mappingFilePath parameter.
envObjList = new EnvObjectList();

envObjList.addAllObjectsToExport("CATALOG");
envObjList.addAllObjectsToExport("CATALOG_VIEW");
envObjList.addAllObjectsToExport("HIERARCHY_VIEW");
envObjList.addAllObjectsToExport("MAPS");
envObjList.addAllObjectsToExport("LOOKUP_TABLE");

ADD ADDITIONAL OBJECT TYPES HERE

sDocFilePath = "archives/mycompleteexport.zip";
mappingFilePath = "archives/nameMapping.xml"
exportEnv(envObjList, sDocFilePath, mappingFilePath);
For more information, see Specifying file names for exported objects.
Scripts example to deploy object types with only the object type entities that the script specifies:
When you specify the catalog and hierarchy content and object types, you must:
  1. Specify the object type.
  2. Set the name of the hierarchy or catalog object types with the setHierarmchyByNameToExport or setcatalogByNameToExport script operation.
  3. Set the attribute collection of the hierarchy or catalog object types with the addObjectByNameToExport or addAllObjectsToExport.
  4. You must place envObjList.addAllObjectsToExport() after both the envObjList.setTypeToExport("CATALOG_CONTENT") and envObjList.setHierarchyByNameToExport("Catalog Name") scripts if you have catalogs that are set up without a user defined core attribute collection.
For item-to-category maps and hierarchy maps, use the following script operations:
  1. Set the source and destination hierarchies to export with the setHierarchyMapToExport.
  2. Set both the catalog and hierarchy names that the items are mapped to with the setItemCategoryMapToExport script operation.
//Create the list for export
envObjList = new EnvObjectList();

//Set the type of object to be exported
envObjList.setTypeToExport("CATALOG");

//Set the entities for that specified object type
//"Admin Ctg" will be exported in "CREATE" mode 
envObjList.addObjectByNameToExport("Admin Ctg", "CREATE");

//"CE Admin 1Ctg" will be exported in "UPDATE" mode 
envObjList.addObjectByNameToExport("CE Admin 1 Ctg", "UPDATE");

//Set the object type to export
envObjList.setTypeToExport("HIERARCHY_CONTENT"); 

//set the name of the hierarchy whose content needs to be exported 
envObjList.setHierarchyByNameToExport("CE Master CatTree");

//Add the list of attribute collections to be exported
envObjList.addObjectByNameToExport(“Attr Collec1”);

//Set the object type to export
envObjList.setTypeToExport("CATALOG_CONTENT"); 

//set the name of the catalog whose content needs to be exported 
envObjList.setCatalogByNameToExport("CE Master CTG");

//Add the list of attribute collections to be exported
envObjList.addObjectByNameToExport(“Attr Collec2”);

//The CREATE_OR_UPDATE action mode will be used.
envObjList.setHierarchyMapToExport (“Hierarchy1”, “Hierarchy2”); 

//Set the Hierarchy maps to export, Catalog refers to catalog 
//name, and Hierarchy refers to hierarchy name
//hierarchy and Hierarchy2 refers to destination hierarchy
envObjList.setHierarchyMapToExport (“CATALOG”, “HIERARCHY”);

//Set the document store path to export files 
envObjList.setTypeToExport("DOC_STORE");
envObjList.addObjectByNameToExport(“/scripts”);

ADD ADDITIONAL OBJECT TYPES HERE

//The document store path where the exported file is stored
sDocFilePath = "archives/partialcontentexport.zip";

//Pass the object list and the document store path to ExportEnv operation
exportEnv(envObjList, sDocFilePath);

For this example script to work successfully, you must revise the attribute collection Attr Collec2 and set it to your user-defined core attribute collection for the catalog.