Adobe Campaign JavaScript SDK

The Schema API

Reading schemas is a common operation in Campaign. The SDK provides a convenient functions as well as caching for efficient use of schemas.

In addition, have a look at the Application object which contains an object model for accessing and traversing schemas

const schema = await client.getSchema("nms:recipient");
console.log(JSON.stringify(schema));

A given representation can be forced

const xmlSchema = await client.getSchema("nms:recipient", "xml");
const jsonSchema = await client.getSchema("nms:recipient", "SimpleJson");

System enumerations can also be retreived with the fully qualified enumeration name

const sysEnum = await client.getSysEnum("nms:extAccount:encryptionType");

or from a schema

const schema = await client.getSchema("nms:extAccount");
const sysEnum = await client.getSysEnum("encryptionType", schema);

Get a source schema

var srcSchema = await NLWS.xtkPersist.getEntityIfMoreRecent("xtk:srcSchema|nms:recipient", "", false);
console.log(JSON.stringify(srcSchema));

Group schemas

Campaign groups represent marketing lists or audiences. Each group can have it's own specific schema, stored in the `extension` XML element of the group entity. This schema can be generated in a workflow by using the List Update activity.

The schema of a group can be retrieved using the `getSchema` method of the client or application objects.

The schema id is build as followed: prefix `temp:group:` + id of the group in mms:group (example `temp:group:1234` )

Note: group schemas are not cached. The rationale is that they are not accessed as frequently as other, regular schemas, but more importantly that they can change more often that regular schemas.