1

I'm throwing together a POC to see how difficult it will be to create custom Content Blocks in house. I've followed the installation instructions here (I think):

https://github.com/salesforce-marketingcloud/blocksdk

and created a very simple app using heroku:

<html>
<head></head>
  <body>
  <script src="blocksdk.js"></script>
  <script>
  function myFunction(clicked_value) {
    console.log(clicked_value);
    var sdk = new window.sfdc.BlockSDK();
    sdk.setContent(clicked_value, function (content) { 
        console.log('Content Set');
        console.log(content);
    });
//        sdk.setSuperContent(clicked_value, function (setContent) { });
      console.log('Ran');
  }

</script>

MyDate: <input type="text" id="mydate" onfocusout="myFunction(this.value)"/>
  </body>
</html>

I'm testing this using the heroku Block Tester App:

http://blocktester.herokuapp.com/

In the console I'm seeing clicked_value and 'Ran', but setContent doesn't seem to be doing anything. I know that setContent is running (I've tested it by amending the underlying code).

So I'm stuck with not knowing what I've done wrong, can anyone see anything I'm missing in my code?

1
  • It looks like this isn't a problem with my code as I've copied the sample code from here: github.com/tbesluau/sampleblock and I'm facing the same issue, the functions are all running, but the content isn't being updated
    – Blujay
    Jan 16, 2019 at 14:22

1 Answer 1

1

You need to use https for the blocktester and widget URLs

1
  • thanks just adding the s to http worked for me May 27, 2021 at 22:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .