Options – Effective way to store and pass configurations across Adobe Campaign

Adobe Campaign provides an inherent Options table that stores data more like key-value pairs.  We can use this table to:

  1. Store global configuration like connection strings, third party credentials, last processing dates and so on.
  2. Initialize and pass configuration across various functional blocks like Web application, Workflow, Delivery properties etc.
  3. Keep user-specific or environment-specific settings outside the base development code which can facilitate in easy pushing code across environments.
  4. Change in environment setting doesn’t require update of code since configurations can be updated separately and outside.

The simplicity to getting and retrieving values like key-value pair makes it as strong candidate to accomplish the above tasks.

One way to create an entry to Options table is through Adobe Campaign Client Console Explorer. Check for the node Administration > Platform > Options as shown below.

AC Options

Alternatively, we can get and set the Options programmatically using  below JS methods:

getOption –Returns the value of an option in the options table.The value of the option if the option exists, otherwise undefined. The type of the value depends on the type of the option.
getOption (name)

var lastCompletionDate = getOption("WORKFLOW_LAST_COMPLETION_DATE");

setOption – Changes the value of an option in the options table. Returns none.
setOption (name, value)

var lastCompletionDate = formatDate(new Date(), "%4Y-%2M-%2D");
setOption("WORKFLOW_LAST_COMPLETION_DATE", lastCompletionDate);

Further, since we can now programmatically get & set the values, we have flexibility of making code more dynamic. Consider a scenario where we want to store number of mail sent separately based on day of week.

//var noOfEmailSent = ****;
var d = new Date();
var dayOfWeek = d.getDay(); 
setOption("EMAIL_SENT_ON_DAY_" + dayOfWeek, noOfEmailSent);

So, here we are creating the Options dynamically and storing the values separetly.

(Visited 1,508 times, 1 visits today)