DASHBOARD - RETRIEVE SENDABLE OR NON SENDABLE DATA EXTENSIONS

 RETRIEVE SENDABLE OR NON SENDABLE DATA EXTENSIONS

USE CASE :

IT HAS BEEN OBSERVERED, SPECIALLY DURING CONTACT DELETION, WE NEED TO KNOW WHICH ALL DATA EXTENSIONS ARE SENDABLE AND WHICH ALL ARE NON-SENDABLE.
DURING CONTACT DELETION IS BECOMES MANDATORY TO MAKE DATA EXTENSIONS SENDABLE SO THAT THE SUBSCRIBER DETAILS GETS DELETED FROM ALL DATA EXTESNIONS WHEREEVER IT HAS BEEN STORED.

IF YOU ARE NOT FAMILIAR WITH CONTACT DELETION HERE IS THE LINK : SOURCE

WE MAY WRITE SSJS SCRIPT ACTIVITY AND FETCH DATA EXTENSIONS PROBABLY BUT IT HAS OVERHEAD IN PROCESSING. WITH THE USE OF WS-PROXY WE CAN REDUCE THE OVERHEAD AND ALSO INCREASE SPEED OF THE API CALL.

SO HERE WE ARE GOING TO USE WS-PROXY TO RETRIEVE DATA EXTESNIONS AND DIFFERENTIATE BETWEEN SENDABLE AND NON SENDABLE DATA EXTENIONS.

RETRIEVE SENDABLE DATA EXTENSIONS :

<script runat="server" language="javascript">
  Platform.Load("core", "1");
  var prox = new Script.Util.WSProxy();
  var props = {
    QueryAllAccounts: true };
  var cols = ["Name","CustomerKey","CategoryID","IsSendable"];
  var filter = {
    Property: "IsSendable",
  SimpleOperator: "equals",
  Value: true
  };
  var opts = {
    BatchSize: 25
  };
  var data = prox.retrieve("DataExtension", cols,filter);
  Write(Stringify(data.Results[0]));
</script>

HERE WE ARE USING A FILTER WITH "ISSENDABLE" PROPERTY, YOU CAN EITHER TOGGLE BETWEEN TRUE OR FALSE. I HAVE WRITTEN THE ABOVE CODE IN CODE RESOURCE JS. ITS EASY TO DEBUG AND LEARN.


WE CAN USE THE ABOVE CODE IN LANDING PAGE AND PRINT THE DATA EXTENSIONS IN A TABULAR FORMAT FOR BETTER PRESENTATION. 

SOURCE CODE :
<!DOCTYPE html>
<html>
  <head>
    <meta name="viewport" content="width=device-width,
initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/css/bootstrap.min.css">
    <script
src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/js/bootstrap.bundle.min.js">
</script>
  </head>
  <br/>
  <br/>
  <div class="d-flex justify-content-center" style="padding:20px;">
    <div class="dropdown">
      <a class="btn btn-secondary dropdown-toggle" href="#"
role="button" data-bs-toggle="dropdown" aria-expanded="false" >
        Data Extension Type
      </a>
      <ul class="dropdown-menu">
        <li>
          <a class="dropdown-item" href="?at=true">Sendable</a>
        </li>
        <li>
          <a class="dropdown-item" href="?at=false">Non Sendable</a>
        </li>
      </ul>
    </div>
    <br/>
  </div>
  <table class="table table-bordered table-dark" style="width:100%;padding:50px;">
    <thead>
      <tr>
        <th scope="col">#
        </th>
        <th scope="col">Name
        </th>
        <th scope="col">CustomerKey
        </th>
        <th scope="col">CategoryID
        </th>
      </tr>
    </thead>
    <tbody>
      %%[set @status=QueryParameter('at')]%%
      <script runat="server" language="javascript">
        Platform.Load("core", "1");
        var prox = new Script.Util.WSProxy();
        var status=Variable.GetValue("@status");
        var props = {
          QueryAllAccounts: true };
        var cols = ["Name","CustomerKey","CategoryID","IsSendable"];
        var filter = {
          Property: "IsSendable",
          SimpleOperator: "equals",
          Value: status
        };
        var opts = {
          BatchSize: 25
        };
        var data = prox.retrieve("DataExtension", cols,filter);
        for (var i=0;i<data.Results.length; i++)
          {
            Write('<tr>')
            Write('<td>' + i +'</td>');
            Write('<td>' + data.Results[i].Name +'</td>');
            Write('<td>' + data.Results[i].CustomerKey +'</td>');
             Write('<td>' + data.Results[i].CategoryID +'</td>');
            Write('</tr>')
          }
        //Write(Stringify(data.Results));
      </script>
    </tbody>
  </table>
  <p class="d-flex justify-content-center">
    Thank you for selecting  %%=QueryParameter('at')=%%.
  </p>
  <br/>
  <br/>
</html>

BOOTSTRAP CDN ARE MANDATORY FOR LOOK AND FEEL PLUS INCORPORATING THE RESPONSIVENESS OF THE PAGE. I HIGLHY RECOMMEND TO FOLLOW THE PAGE : BOOTSTRAP

I HAVE CREATED A DROP DOWN WITH DROP DOWN MENU AS AN UNORDERD LIST. FOR TRIGGERING THE DROPDOWN SELECTION I HAVE USED ANCHOR TAG WITH HREF THAT WOULD SIMPLIFY MY SOLUTION TO APPEND A QUERY PARAMTER IN THE URL AND RETRIEVE THE PARAM ON EVERY DOM REFRESH.




Comments

Most Viewed

CLOUD PAGE ENABLEMENT - PART 1

EMAIL NOT SENT IN JOURNEY BUILDER

CONSIDERATIONS FOR JOURNEY BUILDER

Understanding Transactional Messaging

Preference Center Demystified


Knowledge Article

Popular Posts

CLOUD PAGE ENABLEMENT - PART 1

EMAIL NOT SENT IN JOURNEY BUILDER

CONSIDERATIONS FOR JOURNEY BUILDER

Understanding Transactional Messaging

Preference Center Demystified

Journey Builder REST API Documentation

Share with Friends

Disclaimer:

The information provided on this technical blog is for general informational purposes only. As a SFMC (Salesforce Marketing Cloud) Technical Architect, I strive to offer accurate and up-to-date content related to SFMC and its associated technologies. However, please note that technology is constantly evolving, and the information provided may become outdated or inaccurate over time.

The content published on this blog represents my personal views and experiences as a SFMC Technical Architect and does not necessarily reflect the official views or opinions of any organization or employer I may be affiliated with.

While I make every effort to ensure the accuracy and reliability of the information presented, I cannot guarantee its completeness, suitability, or applicability to your specific circumstances. Therefore, it is essential to verify any information provided and make your own independent assessments or seek professional advice if needed.

Furthermore, any actions taken based on the information provided on this blog are at your own risk. I shall not be held liable for any damages, losses, or inconveniences arising from the use of the information presented here.

Please keep in mind that SFMC and its associated technologies are complex and require technical expertise for proper implementation and management. It is recommended to consult with qualified professionals or official SFMC documentation for comprehensive guidance.

Finally, please note that any product or company names mentioned on this blog are trademarks or registered trademarks of their respective owners. The mention of these trademarks or registered trademarks does not imply any endorsement or affiliation with the blog.

By accessing and using this blog, you agree to the terms of this disclaimer. If you do not agree with any part of this disclaimer, please refrain from using this blog.