Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Create a new project titled “Configuration” within each environment (Dev, Stage, Prod). This is the project that we will not be moving whenever publishing our real project.

  2. Open the Configuration project.

  3. Under Develop > Schema and create a new Schema and a name for it. In this example, we will name it “Settings.” We will set it as dynamic data with one field.

  4. This will hold the key value pair between Dev, Stage, and Production.

    Image RemovedImage Added
  5. Now we will go to Report > Data > Settings > Settings> and create a content block and a name for it. For this example, we will call it “Settings A.”

    Image RemovedImage Added
    1. This is the key value pair we will keep here and what we will keep the same across all of the environments.

      Image RemovedImage Added
    2. You can add as many key values here as you want.

      Image RemovedImage Added
  6. Now we need to make sure this Configuration project is created with all of the same Schema and Data settings we have just created across Dev, Stage, and Production.

    1. The key is very important - we need to keep the same key across all of the same environments.

  7. To use it, let’s go into Experience Designer of the project you are trying to set up and we will be adding in the following nodes.

    Image Added
    1. Add an Inject node and set it to after 0.1 as we want it to be loaded as fast as possible.

      Image RemovedImage Added
    2. Then add a Function node and name it “Set Model." Set the key to the schema key key

      Image Added
    3. Add a Dynamic data Data Manager node and program into the Settings

      Image RemovedImage Added
      1. Make sure the content name is the same the same as the one we have created

    4. Add another Function node and title it “Set to Global context.This is where we will set Setting Settings into the Global context for Experience Designer

      Image RemovedImage Added
      1. We recommend only one settings content so that the below code will only return one

      otherwise
      1. . Otherwise, make sure the correct settings item name is used.

        Code Block
        var settings = _.get(msg, 'data.dynamicData.result[0].payload', {});
      2. We will create a key in global setting called “Config Setting” and store the settings that we have to retrieve so that we can use it whenever we need to.

        Code Block
        global.set("CONFIG_SETTING", settings);
  8. Let’s test it to see if it is working. Let’s insert Insert an Inject node and a Function node to Check Config.

Now when we click on this, it will pull the settings we’ve created as part of the content under the settings we have created in within the Configuration project.

...

Info

If you change the settings within the Configuration project, it will only display if you deploy the global context again.