From 289e89d297b699fd9c85c6c88be189d7c7713caf Mon Sep 17 00:00:00 2001 From: sfcbetiuc <42634794+sfcbetiuc@users.noreply.github.com> Date: Wed, 30 Oct 2019 18:48:48 +0200 Subject: [PATCH] SampleHelper, ConfigurationObjectClient refactor - Modified the email asset views - Removed the DELETE email send definition example from the ConfigurationObjectClient sample because it was generally executed faster than the status change from queued email to sent email, thus email not getting sent --- test/samples/ConfigurationObjectClient.js | 6 +---- test/samples/SampleHelper.js | 27 +++++++++++++++-------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/test/samples/ConfigurationObjectClient.js b/test/samples/ConfigurationObjectClient.js index b4976a3..d6c7bfa 100644 --- a/test/samples/ConfigurationObjectClient.js +++ b/test/samples/ConfigurationObjectClient.js @@ -51,9 +51,5 @@ const SalesforceMarketingCloud = require('../../src'); // Get the send status of the email send: let recipientSendStatus = await transactionalMessagingApi.getEmailSendStatusForRecipient(messageKey); - console.log('send status for recipient: ' + JSON.stringify(recipientSendStatus)); - - // Delete email send definition: - let deleteEmailDefinitionResult = await transactionalMessagingApi.deleteEmailDefinition(createEmailDefinitionResult.definitionKey); - console.log('deleteEmailDefinitionResult: ' + JSON.stringify(deleteEmailDefinitionResult)); + console.log('recipientSendStatus: ' + JSON.stringify(recipientSendStatus)); })(); \ No newline at end of file diff --git a/test/samples/SampleHelper.js b/test/samples/SampleHelper.js index c2b67a8..176c061 100644 --- a/test/samples/SampleHelper.js +++ b/test/samples/SampleHelper.js @@ -1,5 +1,3 @@ -const Asset = require('../../src/Model/Asset'); -const AssetType = require('../../src/Model/AssetType'); const SalesforceMarketingCloud = require('../../src'); class SampleHelper { @@ -10,17 +8,28 @@ class SampleHelper { const HTML_EMAIL_ASSET_TYPE_ID = 208; const ASSET_TYPE_NAME = 'htmlemail'; - let assetType = new AssetType(HTML_EMAIL_ASSET_TYPE_ID, ASSET_TYPE_NAME); + let assetType = new SalesforceMarketingCloud.AssetType(HTML_EMAIL_ASSET_TYPE_ID, ASSET_TYPE_NAME); - let asset = new Asset(customerKey, assetType, assetName, assetDescription); - - /* An email asset has to have at least these minimal - properties set in order for the send definition to become active*/ + let asset = new SalesforceMarketingCloud.Asset(customerKey, assetType, assetName, assetDescription); asset.views = { 'subjectline': { - 'content': 'New TS Subject Line' - } + 'content': 'Email generated from the Node.js SDK' + }, + "html": { + "content": "\n" + + "\n" + + "
\n" + + " \n" + + "