Loading
About Salesforce Data 360
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          Review the Data in Marketing Cloud Engagement

          Review the Data in Marketing Cloud Engagement

          After the segment is activated, a data extension is added to the Marketing Cloud Engagement business unit that you identified in the activation.

          Here’s the data extension based on this activation use case.

          Sample Data extension

          The first four columns are required based on the activation type (SMS). The FirstName column is the selected direct attribute. The last column contains the related attributes formatted as a JSON code block in one data extension field. The column name, Loyalty_Program_Member, is named after the API name of the related attribute’s main DMO.

          • Program Name
          • Previous Loyalty Tier
          • Loyalty Tier

          These attributes are provided in the JSON code block.

          [
            {
              "program_name": "Premiere Plus",
              "Loyalty_Member_Tier": [
                {
                  "previous_loyalty_tier": "Silver",
                  "loyalty_tier": "Gold"
                }
              ]
            }
          ]

          You can parse this data with either SSJS, AMPscript, or GTL. Here’s an example of parsing with SSJS.

          <script runat="server">
              Platform.Load("core","1");
            
              //Get First Name from Data Extension
              var First_Name = Platform.Recipient.GetAttributeValue("FirstName");
              Variable.SetValue("@First_Name", First_Name);
          
              //Get and Parse JSON Block from Data Extension
              var JSONblock = Platform.Recipient.GetAttributeValue("Loyalty_Program_Member");
              var JSONObj = Platform.Function.ParseJSON(JSONblock);
          
              //Read JSON Block variables
              Variable.SetValue("@program_name", JSONObj[0]["program_name"]);
              Variable.SetValue("@loyalty_tier", JSONObj[0]["Loyalty_Member_Tier"][0]["loyalty_tier"]);
          </script>
          
          Congrats, %%=v(@First_Name)=%%!! Your %%=v(@program_name)=%% loyalty status level has changed to
          %%=v(@loyalty_tier)=%%!

          Here’s an example of parsing with AMPscript.

          
          %%[
          var @ProgramRowset, @ProgramRow, @ProgramName, @LoyaltyTierRowset, @LoyaltyTierRow, @LoyaltyTier
          
          
          /* Query the first JSON object from the related attributes array. */
          set @ProgramRowset=BuildRowsetFromJson(Loyalty_Program_Member,"$.[0]", false)
          
          
          /* Get the program_name value. */
          set @ProgramRow=row(@ProgramRowset, 1)
          set @ProgramName=field(@ProgramRow, "program_name")
          
          
          /* Query the first Loyalty_Member_Tier object inside of the first object. */
          set @LoyaltyTierRowset=BuildRowsetFromJson(Loyalty_Program_Member,"$.[0]['Loyalty_Member_Tier'][0]", false)
          
          
          /* Get the loyalty_tier value */
          set @LoyaltyTierRow=row(@LoyaltyTierRowset, 1)
          set @LoyaltyTier=field(@LoyaltyTierRow, "loyalty_tier")
          
          
          /* Print the message */
          OutputLine(concat("Congrats, ", FirstName, "!! Your ", @ProgramName, " loyalty status level has changed to ", @LoyaltyTier, "!"))
          ]%%
          
          </script>
           
          Loading
          Salesforce Help | Article