Skip to content

Commit

Permalink
Merge pull request #1699 from Accenture/task/1680-show-cc-and-bcc-val…
Browse files Browse the repository at this point in the history
…ues-in-journeys-as-array

task/1680 list CC and BCC values on journey email activities and in triggeredSend as arrays
  • Loading branch information
JoernBerkefeld authored Sep 12, 2024
2 parents 9cb11a2 + 2358697 commit f2176b1
Show file tree
Hide file tree
Showing 24 changed files with 63 additions and 38 deletions.
2 changes: 1 addition & 1 deletion @types/lib/metadataTypes/Journey.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 32 additions & 5 deletions lib/metadataTypes/Journey.js
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,8 @@ class Journey extends MetadataType {
triggeredSend.emailId = linkedTS.Email?.ID;
triggeredSend.dynamicEmailSubject = linkedTS.DynamicEmailSubject;
triggeredSend.emailSubject = linkedTS.EmailSubject;
triggeredSend.bccEmail = linkedTS.BccEmail;
// only the bccEmail field can be retrieved for triggeredSends, not the ccEmail field; for some reason BccEmail can be retrieved but does not return a value even if stored correctly in the journey.
// triggeredSend.bccEmail = linkedTS.BccEmail;
triggeredSend.isMultipart = linkedTS.IsMultipart;
triggeredSend.autoAddSubscribers = linkedTS.AutoAddSubscribers;
triggeredSend.autoUpdateSubscribers =
Expand Down Expand Up @@ -736,6 +737,13 @@ class Journey extends MetadataType {
delete triggeredSend.key;
}

triggeredSend.ccEmail = triggeredSend.ccEmail
.split(';')
.filter((el) => el !== '');
triggeredSend.bccEmail = triggeredSend.bccEmail
.split(';')
.filter((el) => el !== '');

// List (optional)
triggeredSend.r__list_PathName ||= {};
if (triggeredSend.publicationListId) {
Expand Down Expand Up @@ -1222,6 +1230,15 @@ class Journey extends MetadataType {
delete triggeredSend.r__triggeredSend_key;
}

triggeredSend.ccEmail =
typeof triggeredSend.ccEmail === 'string'
? triggeredSend.ccEmail
: triggeredSend.ccEmail.join(';');
triggeredSend.bccEmail =
typeof triggeredSend.bccEmail === 'string'
? triggeredSend.bccEmail
: triggeredSend.bccEmail.join(';');

// List (optional)
if (triggeredSend.r__list_PathName) {
if (triggeredSend.r__list_PathName.publicationList) {
Expand Down Expand Up @@ -1476,23 +1493,33 @@ class Journey extends MetadataType {
if (triggeredSend) {
// the following is very similar but not equal to the variables in TriggeredSend.js
try {
triggeredSend.bccEmail = ReplaceCbReference.replaceReference(
triggeredSend.bccEmail,
let bccEmail =
typeof triggeredSend.bccEmail === 'string'
? triggeredSend.bccEmail
: triggeredSend.bccEmail.join(';');
bccEmail = ReplaceCbReference.replaceReference(
bccEmail,
parentName,
findAssetKeys
);
triggeredSend.bccEmail = bccEmail.split(';').filter((el) => el !== '');
changes = true;
} catch (ex) {
if (ex.code !== 200) {
error = ex;
}
}
try {
triggeredSend.ccEmail = ReplaceCbReference.replaceReference(
triggeredSend.ccEmail,
let ccEmail =
typeof triggeredSend.ccEmail === 'string'
? triggeredSend.ccEmail
: triggeredSend.ccEmail.join(';');
ccEmail = ReplaceCbReference.replaceReference(
ccEmail,
parentName,
findAssetKeys
);
triggeredSend.ccEmail = ccEmail.split(';').filter((el) => el !== '');
changes = true;
} catch (ex) {
if (ex.code !== 200) {
Expand Down
6 changes: 4 additions & 2 deletions lib/metadataTypes/definitions/TriggeredSend.definition.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,11 @@ export default {
templating: true,
},
BccEmail: {
// while this can be retrieved, it seems to be always returned empty
isCreateable: true,
isUpdateable: true,
retrieving: true,
templating: true,
retrieving: false,
templating: false,
},
CategoryID: {
isCreateable: true,
Expand All @@ -79,6 +80,7 @@ export default {
templating: true,
},
CCEmail: {
// this field is updatable but not retrievable for some reason
isCreateable: true,
isUpdateable: true,
retrieving: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"AutoAddSubscribers": false,
"AutoUpdateSubscribers": false,
"BatchInterval": 0,
"BccEmail": "",
"CreatedDate": "2018-06-25T05:58:00",
"CustomerKey": "testExisting_triggeredSend",
"Description": "updated on deploy",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"AutoAddSubscribers": false,
"AutoUpdateSubscribers": false,
"BatchInterval": 0,
"BccEmail": "",
"CreatedDate": "2018-06-25T05:58:00",
"CustomerKey": "testNew_triggeredSend",
"Description": "created on deploy",
Expand Down
6 changes: 4 additions & 2 deletions test/resources/9999999/journey/build-expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@
"triggeredSend": {
"autoAddSubscribers": true,
"autoUpdateSubscribers": true,
"bccEmail": "%%= ContentBlockByName(\"Content Builder\\dont strip non ssjs content\") =%%",
"ccEmail": "%%= ContentBlockByKey(\"testTemplated_asset_htmlblock\") =%%",
"bccEmail": [
"%%= ContentBlockByName(\"Content Builder\\dont strip non ssjs content\") =%%"
],
"ccEmail": ["%%= ContentBlockByKey(\"testTemplated_asset_htmlblock\") =%%"],
"created": {},
"description": "my activity info text",
"dynamicEmailSubject": "testTemplated_ dynamic email subject %%= ContentBlockByKey(\"testTemplated_asset_htmlblock\") =%%",
Expand Down
4 changes: 2 additions & 2 deletions test/resources/9999999/journey/get-multistep-expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@
"triggeredSend": {
"autoAddSubscribers": false,
"autoUpdateSubscribers": false,
"bccEmail": "",
"ccEmail": "",
"bccEmail": [],
"ccEmail": [],
"created": { "name": "", "date": "" },
"description": "my custom description",
"domainExclusions": [],
Expand Down
6 changes: 4 additions & 2 deletions test/resources/9999999/journey/get-quicksend-expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@
"triggeredSend": {
"autoAddSubscribers": true,
"autoUpdateSubscribers": true,
"bccEmail": "%%= ContentBlockByName(\"Content Builder\\dont strip non ssjs content\") =%%",
"ccEmail": "%%= ContentBlockByKey(\"testExisting_asset_htmlblock\") =%%",
"bccEmail": [
"%%= ContentBlockByName(\"Content Builder\\dont strip non ssjs content\") =%%"
],
"ccEmail": ["%%= ContentBlockByKey(\"testExisting_asset_htmlblock\") =%%"],
"created": {},
"description": "my activity info text",
"dynamicEmailSubject": "testExisting_ dynamic email subject %%= ContentBlockByKey(\"testExisting_asset_htmlblock\") =%%",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
"triggeredSend": {
"autoAddSubscribers": true,
"autoUpdateSubscribers": true,
"bccEmail": "%%= ContentBlockById(1295064) =%%",
"ccEmail": "%%= ContentBlockById(1295064) =%%",
"bccEmail": ["%%= ContentBlockById(1295064) =%%"],
"ccEmail": ["%%= ContentBlockById(1295064) =%%"],
"created": {},
"description": "my activity info text",
"dynamicEmailSubject": "testExisting_ dynamic email subject %%= ContentBlockById(1295064) =%%",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
"triggeredSend": {
"autoAddSubscribers": true,
"autoUpdateSubscribers": true,
"bccEmail": "%%= ContentBlockByKey(\"testExisting_asset_htmlblock\") =%%",
"ccEmail": "%%= ContentBlockByKey(\"testExisting_asset_htmlblock\") =%%",
"bccEmail": ["%%= ContentBlockByKey(\"testExisting_asset_htmlblock\") =%%"],
"ccEmail": ["%%= ContentBlockByKey(\"testExisting_asset_htmlblock\") =%%"],
"created": {},
"description": "my activity info text",
"dynamicEmailSubject": "testExisting_ dynamic email subject %%= ContentBlockByKey(\"testExisting_asset_htmlblock\") =%%",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,12 @@
"triggeredSend": {
"autoAddSubscribers": true,
"autoUpdateSubscribers": true,
"bccEmail": "%%= ContentBlockByName(\"Content Builder\\dont strip non ssjs content\") =%%",
"ccEmail": "%%= ContentBlockByName(\"Content Builder\\dont strip non ssjs content\") =%%",
"bccEmail": [
"%%= ContentBlockByName(\"Content Builder\\dont strip non ssjs content\") =%%"
],
"ccEmail": [
"%%= ContentBlockByName(\"Content Builder\\dont strip non ssjs content\") =%%"
],
"created": {},
"description": "my activity info text",
"dynamicEmailSubject": "testExisting_ dynamic email subject %%= ContentBlockByName(\"Content Builder\\dont strip non ssjs content\") =%%",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
"triggeredSend": {
"autoAddSubscribers": true,
"autoUpdateSubscribers": true,
"bccEmail": "",
"ccEmail": "",
"bccEmail": [],
"ccEmail": [],
"created": {},
"domainExclusions": [],
"dynamicEmailSubject": "test email",
Expand Down
6 changes: 4 additions & 2 deletions test/resources/9999999/journey/template-expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@
"triggeredSend": {
"autoAddSubscribers": true,
"autoUpdateSubscribers": true,
"bccEmail": "%%= ContentBlockByName(\"Content Builder\\dont strip non ssjs content\") =%%",
"ccEmail": "%%= ContentBlockByKey(\"{{{prefix}}}asset_htmlblock\") =%%",
"bccEmail": [
"%%= ContentBlockByName(\"Content Builder\\dont strip non ssjs content\") =%%"
],
"ccEmail": ["%%= ContentBlockByKey(\"{{{prefix}}}asset_htmlblock\") =%%"],
"created": {},
"description": "my activity info text",
"dynamicEmailSubject": "{{{prefix}}} dynamic email subject %%= ContentBlockByKey(\"{{{prefix}}}asset_htmlblock\") =%%",
Expand Down
1 change: 0 additions & 1 deletion test/resources/9999999/triggeredSend/build-expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"AutoAddSubscribers": false,
"AutoUpdateSubscribers": false,
"BatchInterval": 0,
"BccEmail": "",
"CreatedDate": "2018-06-25T05:58:00",
"CustomerKey": "testTemplated_triggeredSend",
"Description": "Unsubscribe_Email",
Expand Down
1 change: 0 additions & 1 deletion test/resources/9999999/triggeredSend/get-expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"AutoAddSubscribers": false,
"AutoUpdateSubscribers": false,
"BatchInterval": 0,
"BccEmail": "",
"CreatedDate": "2018-06-25T05:58:00",
"CustomerKey": "testExisting_triggeredSend",
"Description": "Unsubscribe_Email",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"AutoAddSubscribers": false,
"AutoUpdateSubscribers": false,
"BatchInterval": 0,
"BccEmail": "",
"CreatedDate": "2018-06-25T05:58:00",
"CustomerKey": "testExisting_triggeredSend_rcb",
"Description": "Unsubscribe_Email",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"AutoAddSubscribers": false,
"AutoUpdateSubscribers": false,
"BatchInterval": 0,
"BccEmail": "",
"CreatedDate": "2018-06-25T05:58:00",
"CustomerKey": "testExisting_triggeredSend_rcb",
"Description": "Unsubscribe_Email",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"AutoAddSubscribers": false,
"AutoUpdateSubscribers": false,
"BatchInterval": 0,
"BccEmail": "",
"CreatedDate": "2018-06-25T05:58:00",
"CustomerKey": "testExisting_triggeredSend_rcb",
"Description": "Unsubscribe_Email",
Expand Down
1 change: 0 additions & 1 deletion test/resources/9999999/triggeredSend/patch-expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"AutoAddSubscribers": false,
"AutoUpdateSubscribers": false,
"BatchInterval": 0,
"BccEmail": "",
"CreatedDate": "2018-06-25T05:58:00",
"CustomerKey": "testExisting_triggeredSend",
"Description": "updated on deploy",
Expand Down
1 change: 0 additions & 1 deletion test/resources/9999999/triggeredSend/post-expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"AutoAddSubscribers": false,
"AutoUpdateSubscribers": false,
"BatchInterval": 0,
"BccEmail": "",
"CreatedDate": "2018-06-25T05:58:00",
"CustomerKey": "testNew_triggeredSend",
"Description": "created on deploy",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"AutoAddSubscribers": false,
"AutoUpdateSubscribers": false,
"BatchInterval": 0,
"BccEmail": "",
"CreatedDate": "2018-06-25T05:58:00",
"CustomerKey": "{{{prefix}}}triggeredSend",
"Description": "Unsubscribe_Email",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
<AutoAddSubscribers>false</AutoAddSubscribers>
<AutoUpdateSubscribers>false</AutoUpdateSubscribers>
<BatchInterval>0</BatchInterval>
<BccEmail />
<EmailSubject>You are successfully unsubscribed</EmailSubject>
<DynamicEmailSubject>You are successfully unsubscribed</DynamicEmailSubject>
<IsMultipart>false</IsMultipart>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
<AutoAddSubscribers>false</AutoAddSubscribers>
<AutoUpdateSubscribers>false</AutoUpdateSubscribers>
<BatchInterval>0</BatchInterval>
<BccEmail />
<EmailSubject>You are successfully unsubscribed</EmailSubject>
<DynamicEmailSubject>You are successfully unsubscribed</DynamicEmailSubject>
<IsMultipart>false</IsMultipart>
Expand Down Expand Up @@ -106,7 +105,6 @@
<AutoAddSubscribers>false</AutoAddSubscribers>
<AutoUpdateSubscribers>false</AutoUpdateSubscribers>
<BatchInterval>0</BatchInterval>
<BccEmail />
<EmailSubject>%%= ContentBlockById(1295064) =%%</EmailSubject>
<DynamicEmailSubject>%%= ContentBlockById(1295064) =%%</DynamicEmailSubject>
<IsMultipart>false</IsMultipart>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
<AutoAddSubscribers>false</AutoAddSubscribers>
<AutoUpdateSubscribers>false</AutoUpdateSubscribers>
<BatchInterval>0</BatchInterval>
<BccEmail />
<EmailSubject>You are successfully unsubscribed</EmailSubject>
<DynamicEmailSubject>You are successfully unsubscribed</DynamicEmailSubject>
<IsMultipart>false</IsMultipart>
Expand Down

0 comments on commit f2176b1

Please sign in to comment.