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?