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?

  • 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 at 14:22
0

You need to use https for the blocktester and widget URLs

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.