mcdev 4.1.12 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/.eslintrc.json +1 -1
  2. package/.github/ISSUE_TEMPLATE/bug.yml +1 -0
  3. package/.github/PULL_REQUEST_TEMPLATE.md +2 -3
  4. package/.nycrc.json +5 -0
  5. package/README.md +34 -1528
  6. package/boilerplate/config.json +2 -6
  7. package/boilerplate/files/.vscode/extensions.json +1 -0
  8. package/boilerplate/files/.vscode/settings.json +3 -0
  9. package/docs/dist/documentation.md +434 -29
  10. package/lib/Deployer.js +10 -8
  11. package/lib/MetadataTypeDefinitions.js +3 -0
  12. package/lib/MetadataTypeInfo.js +3 -0
  13. package/lib/Retriever.js +14 -7
  14. package/lib/cli.js +1 -0
  15. package/lib/index.js +5 -5
  16. package/lib/metadataTypes/AccountUser.js +2 -2
  17. package/lib/metadataTypes/Asset.js +45 -35
  18. package/lib/metadataTypes/Automation.js +4 -4
  19. package/lib/metadataTypes/DataExtension.js +14 -8
  20. package/lib/metadataTypes/DataExtensionField.js +44 -9
  21. package/lib/metadataTypes/Discovery.js +5 -5
  22. package/lib/metadataTypes/Folder.js +30 -6
  23. package/lib/metadataTypes/List.js +115 -17
  24. package/lib/metadataTypes/MetadataType.js +73 -40
  25. package/lib/metadataTypes/Query.js +2 -2
  26. package/lib/metadataTypes/Script.js +2 -2
  27. package/lib/metadataTypes/TransactionalEmail.js +163 -0
  28. package/lib/metadataTypes/TransactionalMessage.js +127 -0
  29. package/lib/metadataTypes/TransactionalPush.js +77 -0
  30. package/lib/metadataTypes/TransactionalSMS.js +354 -0
  31. package/lib/metadataTypes/TriggeredSendDefinition.js +11 -9
  32. package/lib/metadataTypes/definitions/TransactionalEmail.definition.js +145 -0
  33. package/lib/metadataTypes/definitions/TransactionalPush.definition.js +109 -0
  34. package/lib/metadataTypes/definitions/TransactionalSMS.definition.js +103 -0
  35. package/lib/metadataTypes/definitions/TriggeredSendDefinition.definition.js +36 -36
  36. package/lib/util/auth.js +2 -2
  37. package/lib/util/businessUnit.js +1 -1
  38. package/lib/util/cli.js +19 -20
  39. package/lib/util/config.js +10 -10
  40. package/lib/util/devops.js +4 -4
  41. package/lib/util/init.config.js +7 -7
  42. package/lib/util/init.git.js +11 -23
  43. package/lib/util/init.js +64 -0
  44. package/lib/util/util.js +20 -12
  45. package/package.json +19 -12
  46. package/test/dataExtension.test.js +36 -19
  47. package/test/mockRoot/.mcdevrc.json +13 -2
  48. package/test/mockRoot/deploy/testInstance/testBU/dataExtension/childBU_dataextension_test.dataExtension-meta.json +27 -7
  49. package/test/mockRoot/deploy/testInstance/testBU/query/testExistingQuery.query-meta.json +1 -1
  50. package/test/mockRoot/deploy/testInstance/testBU/query/testExistingQuery.query-meta.sql +3 -1
  51. package/test/mockRoot/deploy/testInstance/testBU/query/{testQuery.query-meta.json → testNewQuery.query-meta.json} +3 -3
  52. package/test/mockRoot/deploy/testInstance/testBU/query/{testQuery.query-meta.sql → testNewQuery.query-meta.sql} +0 -0
  53. package/test/mockRoot/deploy/testInstance/testBU/transactionalEmail/testExisting_temail.transactionalEmail-meta.json +24 -0
  54. package/test/mockRoot/deploy/testInstance/testBU/transactionalEmail/testNew_temail.transactionalEmail-meta.json +24 -0
  55. package/test/mockRoot/deploy/testInstance/testBU/transactionalPush/testExisting_tpush.transactionalPush-meta.json +18 -0
  56. package/test/mockRoot/deploy/testInstance/testBU/transactionalPush/testNew_tpush.transactionalPush-meta.json +18 -0
  57. package/test/mockRoot/deploy/testInstance/testBU/transactionalSMS/testExisting_tsms.transactionalSMS-meta.amp +4 -0
  58. package/test/mockRoot/deploy/testInstance/testBU/transactionalSMS/testExisting_tsms.transactionalSMS-meta.json +15 -0
  59. package/test/mockRoot/deploy/testInstance/testBU/transactionalSMS/testNew_tsms.transactionalSMS-meta.amp +4 -0
  60. package/test/mockRoot/deploy/testInstance/testBU/transactionalSMS/testNew_tsms.transactionalSMS-meta.json +15 -0
  61. package/test/query.test.js +57 -23
  62. package/test/resources/1111111/businessUnit/retrieve-response.xml +33 -0
  63. package/test/resources/1111111/list/retrieve-response.xml +39 -0
  64. package/test/resources/9999999/asset/v1/content/assets/query/post-response.json +72 -0
  65. package/test/resources/9999999/automation/v1/queries/549f0568-607c-4940-afef-437965094dat/patch-response.json +2 -2
  66. package/test/resources/9999999/automation/v1/queries/get-response.json +2 -2
  67. package/test/resources/9999999/automation/v1/queries/post-response.json +3 -3
  68. package/test/resources/9999999/dataExtension/build-expected.json +2 -2
  69. package/test/resources/9999999/dataFolder/retrieve-response.xml +95 -2
  70. package/test/resources/9999999/interaction/v1/interactions/get-response.json +296 -0
  71. package/test/resources/9999999/legacy/v1/beta/mobile/code/get-response.json +32 -0
  72. package/test/resources/9999999/legacy/v1/beta/mobile/keyword/get-response.json +46 -0
  73. package/test/resources/9999999/list/retrieve-response.xml +78 -0
  74. package/test/resources/9999999/messaging/v1/email/definitions/get-response.json +15 -0
  75. package/test/resources/9999999/messaging/v1/email/definitions/post-response.json +19 -0
  76. package/test/resources/9999999/messaging/v1/email/definitions/testExisting_temail/get-response.json +26 -0
  77. package/test/resources/9999999/messaging/v1/email/definitions/testExisting_temail/patch-response.json +26 -0
  78. package/test/resources/9999999/messaging/v1/push/definitions/get-response.json +15 -0
  79. package/test/resources/9999999/messaging/v1/push/definitions/post-response.json +13 -0
  80. package/test/resources/9999999/messaging/v1/push/definitions/testExisting_tpush/get-response.json +13 -0
  81. package/test/resources/9999999/messaging/v1/push/definitions/testExisting_tpush/patch-response.json +13 -0
  82. package/test/resources/9999999/messaging/v1/sms/definitions/get-response.json +15 -0
  83. package/test/resources/9999999/messaging/v1/sms/definitions/post-response.json +17 -0
  84. package/test/resources/9999999/messaging/v1/sms/definitions/testExisting_tsms/get-response.json +18 -0
  85. package/test/resources/9999999/messaging/v1/sms/definitions/testExisting_tsms/patch-response.json +18 -0
  86. package/test/resources/9999999/query/build-expected.json +2 -2
  87. package/test/resources/9999999/query/build-expected.sql +6 -0
  88. package/test/resources/9999999/query/get-expected.json +1 -1
  89. package/test/resources/9999999/query/get-expected.sql +6 -0
  90. package/test/resources/9999999/query/patch-expected.json +1 -1
  91. package/test/resources/9999999/query/patch-expected.sql +6 -0
  92. package/test/resources/9999999/query/post-expected.json +3 -3
  93. package/test/resources/9999999/query/post-expected.sql +4 -0
  94. package/test/resources/9999999/query/template-expected.json +1 -1
  95. package/test/resources/9999999/query/template-expected.sql +6 -0
  96. package/test/resources/9999999/transactionalEmail/build-expected.json +22 -0
  97. package/test/resources/9999999/transactionalEmail/get-expected.json +24 -0
  98. package/test/resources/9999999/transactionalEmail/patch-expected.json +24 -0
  99. package/test/resources/9999999/transactionalEmail/post-expected.json +24 -0
  100. package/test/resources/9999999/transactionalEmail/template-expected.json +22 -0
  101. package/test/resources/9999999/transactionalPush/build-expected.json +8 -0
  102. package/test/resources/9999999/transactionalPush/get-expected.json +11 -0
  103. package/test/resources/9999999/transactionalPush/patch-expected.json +16 -0
  104. package/test/resources/9999999/transactionalPush/post-expected.json +16 -0
  105. package/test/resources/9999999/transactionalPush/template-expected.json +8 -0
  106. package/test/resources/9999999/transactionalSMS/build-expected.amp +4 -0
  107. package/test/resources/9999999/transactionalSMS/build-expected.json +13 -0
  108. package/test/resources/9999999/transactionalSMS/get-expected.amp +4 -0
  109. package/test/resources/9999999/transactionalSMS/get-expected.json +15 -0
  110. package/test/resources/9999999/transactionalSMS/patch-expected.amp +4 -0
  111. package/test/resources/9999999/transactionalSMS/patch-expected.json +15 -0
  112. package/test/resources/9999999/transactionalSMS/post-expected.amp +4 -0
  113. package/test/resources/9999999/transactionalSMS/post-expected.json +15 -0
  114. package/test/resources/9999999/transactionalSMS/template-expected.amp +4 -0
  115. package/test/resources/9999999/transactionalSMS/template-expected.json +13 -0
  116. package/test/transactionalEmail.test.js +120 -0
  117. package/test/transactionalPush.test.js +120 -0
  118. package/test/transactionalSMS.test.js +149 -0
  119. package/test/utils.js +57 -8
package/README.md CHANGED
@@ -1,7 +1,5 @@
1
1
  # Accenture SFMC DevTools
2
2
 
3
- <a id="markdown-accenture-sfmc-devtools" name="accenture-sfmc-devtools"></a>
4
-
5
3
  [![view on npm](https://badgen.net/github/release/Accenture/sfmc-devtools)](https://www.npmjs.org/package/mcdev)
6
4
  [![view on npm](https://badgen.net/npm/node/mcdev)](https://www.npmjs.org/package/mcdev)
7
5
  [![license](https://badgen.net/npm/license/mcdev)](https://www.npmjs.org/package/mcdev)
@@ -11,1556 +9,64 @@
11
9
 
12
10
  Accenture Salesforce Marketing Cloud DevTools (mcdev) is a rapid deployment/rollout, backup and development tool for Salesforce Marketing Cloud. It allows you to retrieve and deploy configuration and code across Business Units and instances.
13
11
 
14
- <!-- TOC -->
15
-
16
- - [1. Changelog](#1-changelog)
17
- - [2. Getting Started](#2-getting-started)
18
- - [2.1. Pre-requisites](#21-pre-requisites)
19
- - [2.1.1. Install Node.js with npm](#211-install-nodejs-with-npm)
20
- - [2.1.2. Install the Git Command Line](#212-install-the-git-command-line)
21
- - [2.2. Install Accenture SFMC DevTools](#22-install-accenture-sfmc-devtools)
22
- - [2.3. Initial project setup](#23-initial-project-setup)
23
- - [2.4. Joining a project that was set up before](#24-joining-a-project-that-was-set-up-before)
24
- - [2.5. Recommended additional installs](#25-recommended-additional-installs)
25
- - [2.6 Using mcdev in other node packages](#26-using-mcdev-in-other-node-packages)
26
- - [3. Updating Accenture SFMC DevTools](#3-updating-accenture-sfmc-devtools)
27
- - [4. Troubleshoot Install/Update](#4-troubleshoot-installupdate)
28
- - [4.1. Installing a specific version](#41-installing-a-specific-version)
29
- - [4.2. Using custom CLIs](#42-using-custom-clis)
30
- - [4.3. Missing write access to...on MacOS](#43-missing-write-access-toon-macos)
31
- - [4.4. ...running scripts is disabled on this system](#44-running-scripts-is-disabled-on-this-system)
32
- - [4.5. Operation not permitted OR No such file or directory](#45-operation-not-permitted-or-no-such-file-or-directory)
33
- - [5. Metadata Type Support](#5-metadata-type-support)
34
- - [6. Command Overview](#6-command-overview)
35
- - [6.1. Maintenance and setup commands](#61-maintenance-and-setup-commands)
36
- - [6.1.1. init](#611-init)
37
- - [6.1.2. upgrade](#612-upgrade)
38
- - [6.1.3. reloadBUs](#613-reloadbus)
39
- - [6.1.4. badKeys](#614-badkeys)
40
- - [6.1.5. document](#615-document)
41
- - [6.1.6. selectTypes](#616-selecttypes)
42
- - [6.1.7. explainTypes](#617-explaintypes)
43
- - [6.2. Operational commands](#62-operational-commands)
44
- - [6.2.1. retrieve](#621-retrieve)
45
- - [6.2.2. deploy](#622-deploy)
46
- - [6.2.3. delete](#623-delete)
47
- - [6.2.4. retrieveAsTemplate](#624-retrieveastemplate)
48
- - [6.2.5. buildTemplate](#625-buildtemplate)
49
- - [6.2.6. buildDefinition](#626-builddefinition)
50
- - [6.2.7. buildDefinitionBulk](#627-builddefinitionbulk)
51
- - [6.2.8. createDeltaPkg](#628-createdeltapkg)
52
- - [7. Advanced Configuration](#7-advanced-configuration)
53
- - [7.1. Config Options](#71-config-options)
54
- - [7.2. Metadata-specific settings & options](#72-metadata-specific-settings--options)
55
- - [7.2.1. Retention Policy fields in Data Extensions](#721-retention-policy-fields-in-data-extensions)
56
- - [7.2.2. Adding/Updating Fields on existing Data Extensions](#722-addingupdating-fields-on-existing-data-extensions)
57
- - [7.2.3. Renaming fields of a Data Extensions](#723-renaming-fields-of-a-data-extensions)
58
- - [7.3. Market Configuration](#73-market-configuration)
59
- - [7.4. Market List Configuration](#74-market-list-configuration)
60
- - [8. Examples](#8-examples)
61
- - [8.1. Retrieve and deploy Data Extension](#81-retrieve-and-deploy-data-extension)
62
- - [8.2. Metadata Retrieving/Backup](#82-metadata-retrievingbackup)
63
- - [8.3. Automation Deployment](#83-automation-deployment)
64
- - [9. Contribute](#9-contribute)
65
- - [9.1. Install Guide for Developers](#91-install-guide-for-developers)
66
- - [9.2. Local install](#92-local-install)
67
- - [9.3. NPM Scripts](#93-npm-scripts)
68
- - [9.4. Developer Documentation](#94-developer-documentation)
69
-
70
- <!-- /TOC -->
71
-
72
- ## 1. Changelog
73
-
74
- <a id="markdown-changelog" name="changelog"></a>
75
-
76
- Find info on the latest changes in our [Changelog](CHANGELOG.md).
77
-
78
- ## 2. Getting Started
79
-
80
- <a id="markdown-getting-started" name="getting-started"></a>
81
-
82
- Accenture SFMC DevTools can be installed as Node.JS package. The following guide will demonstrate how you can get started within 10 minutes or less.
83
-
84
- <a name="pre-requisites"></a>
85
-
86
- ### 2.1. Pre-requisites
87
-
88
- <a id="markdown-pre-requisites" name="pre-requisites"></a>
89
-
90
- #### 2.1.1. Install Node.js with npm
91
-
92
- <a id="markdown-install-node.js-with-npm" name="install-node.js-with-npm"></a>
93
-
94
- 1. To check if it is already installed, at the OS command prompt, type: `node --version`
95
- - If this command reports Node version 14.16.x or later, you’re done—proceed to the next installation. If the reported version is earlier than 14.16.x, continue to step 2.
96
- - If you get a “command not found” error message, continue to step 2.
97
- 2. In a web browser, go to [nodejs.org](https://nodejs.org)
98
- 3. Download and run the latest **LTS** installer for your operating system.
99
- 4. When the installer finishes, try step 1 again. If it fails, please restart your terminal. If it still does not work, reboot your computer and try the version check then.
100
-
101
- #### 2.1.2. Install the Git Command Line
102
-
103
- <a id="markdown-install-the-git-command-line" name="install-the-git-command-line"></a>
104
-
105
- 1. To check if git is already installed, at the OS command prompt, type: `git version`
106
- - If this command reports a git version such as “git version 2.31.0” (or "git version 2.31.0.windows.1" on Windows), you’re done. Proceed to native Android or iOS environment setup.
107
- - If you get a “command not found” error message, continue to step 2.
108
- 2. Go to [git-scm.com/downloads](https://git-scm.com/downloads).
109
- 3. Under Downloads, click the icon for your operating system.
110
- 4. Run the installer.
111
- 5. When the installer finishes, try step 1 again. If it fails, please restart your terminal. If it still does not work, reboot your computer and try the version check then.
112
-
113
- <a name="install-mcdev"></a>
114
-
115
- ### 2.2. Install Accenture SFMC DevTools
116
-
117
- <a id="markdown-install-accenture-sfmc-devtools" name="install-accenture-sfmc-devtools"></a>
118
-
119
- If you experience issues installing Accenture SFMC DevTools, please check out the [Troubleshoot Install/Update](#troubleshoot-installupdate) section in this manual.
120
-
121
- **How to:**
122
-
123
- 1. Install Accenture SFMC DevTools by running `npm install -g mcdev` (prefix with `sudo` on MacOS)
124
- - If you get an error, please see the below troubleshooting section.
125
-
126
- When completed run `mcdev --version` and it will show you which version you installed (e.g. `4.1.12`).
127
-
128
- > **_Side note for proud nerds_:**
129
- >
130
- > The `-g` part behind `npm install` triggers a so-called "global installation". This is a term coined by Package Managers, in this case Node's package manager (npm) and it means that Accenture SFMC DevTools is installed on your computer and usable across projects. The alternative is a "local installation" would install Accenture SFMC DevTools only for the current project folder. This local install is a technique used to ensure everyone in the team is using the same version of a tool. Nevertheless, we strongly recommend going with the global installation to be able to use the full feature-set of Accenture SFMC DevTools.
131
- >
132
- > You may choose to install mcdev globally or locally. Global install runs faster and allows you to initialize new projects by running `mcdev init` in any directory. If your project does require a local installation, please refer to the [Local Install Guide](#local-install).
133
-
134
- ### 2.3. Initial project setup
135
-
136
- <a id="markdown-initial-project-setup" name="initial-project-setup"></a>
137
-
138
- After the successful installation, you will now need to set up the connection to your Marketing Cloud instance.
139
-
140
- 1. In your Marketing Cloud instance
141
- 1. Ensure that you **selected** your **Parent/Global Business Unit**.
142
- 2. Go to `Setup -> Apps -> Installed Packages`.
143
- 3. Create a new "installed package" and name it "Accenture SFMC DevTools Deployment Tool"
144
- > Note: On some older SFMC instances it will ask you if you want the enhanced version. Please enable this option.
145
- 4. Click on the _Add Component_ button and select `API Integration` with `Server-To-Server` mode.
146
- 5. Make sure you grant all available rights.
147
- 6. Go to the access tab and grant it access to all Business Units that you want to use it for, but ensure that the Parent/Global Business Unit is among these.
148
- - _Why?_ Shared Data Extensions, roles, users, Business Unit info and some other metadata is internally stored solely on the parent Business Unit and hence can only be retrieved and updated via that BU.
149
- 7. Note down _EID_ (Parent MID), _Client Id_, _Client Secret_ and _Authentication Base URI_.
150
- 2. In your project folder
151
- 1. Open a CLI in your project folder (e.g. `C:\repos\MyProject\` on Windows or `~/repos/MyProject/` on Mac)
152
- 2. Run `mcdev init` to start the interactive setup wizard.
153
- 1. If not found yet, default configuration files will be copied into your project folder, copied by initializing an npm project and a local Git repository.
154
- 2. The wizard will ask you to name your credential. The name you choose here will be used by all team members because the config is shared via Git.
155
- > Being specific here reduces the chance of deploying to the wrong server (instance) in stressful situations. We suggest you use something like `ClientName`, or `ClientName-ProjectName` if you have multiple projects with the same client. In case your project uses multiples instances you might like to use something like `Client-ProjectName-Sandbox` and `Client-ProjectName-PROD`.
156
- 3. It will then continue to ask for the EID (Parent MID), client ID, client secret and Authentication Base URI.
157
- 4. The credentials will be automatically tested & your list of BUs downloaded until finally the central configuration file `.mcdevrc.json` gets created in your project folder.
158
- 5. The last step is to download an initial backup and commit it into git. No worries - the wizard does that for you!
159
- 3. If this is the first time you set up Accenture SFMC DevTools or you recently upgraded Accenture SFMC DevTools, please restart VS Code now! A pop-up will likely appear in the lower right corner prompting you to install recommended extensions.
160
- 4. Done.
161
- 3. Sharing the project with your team
162
- 1. Make sure you have a Git repo (Bitbucket, GitHub, GitLab) set up somewhere. If you are an SI partner, usually, your client will have to do this for you.
163
- > While running `mcdev init`, the tool already made sure to set up a local Git repo for you. Now, you need to upload ("push") it to the online repo:
164
- 2. Open the URL of your online repo and find the "CLONE" button. This will likely show you a normal URL, ending on ".git"
165
- 3. Add this as your repository remote named "origin". If you use a GUI-based tool, that should be fairly simple, otherwise, execute `git remote add origin YOUR-URL` in your project folder.
166
- 4. Now run `git push -u origin master` to start the upload.
167
-
168
- ### 2.4. Joining a project that was set up before
169
-
170
- <a id="markdown-joining-a-project-that-was-set-up-before" name="joining-a-project-that-was-set-up-before"></a>
171
-
172
- If Accenture SFMC DevTools was already used to set up the project by somebody in your team, including all of the steps in the above chapter [Initial project configuration](#initial-project-setup), then basically you are in luck. Things are much faster from here on:
173
-
174
- 1. Make sure you went through the chapters [Pre-requisites](#pre-requisites) and [Install Accenture SFMC DevTools](#install-mcdev). Do skip [Initial project configuration](#initial-project-setup)!
175
- 2. Acquire the URL to your Git repo and Clone it to your computer. It should end on `.git`. Also ask your team lead for `EID (Parent MID)`, `Client ID`, `Client Secret` and the `Authentication Base URI`. You will need this later.
176
- > We recommend you create a folder like `C:\repos\` and clone the repo for your current project into that. By default, the repo name will be suggested as a sub-folder name which you should keep in place. That way you will always have one folder in which all your projects can be found in with their respective sub-folders.
177
- 3. Open your main repo folder (e.g. `C:\repos\`) in the CLI of your choice (e.g. PowerShell on Windows)
178
- 4. now execute `git clone YOUR-REPO-URL`. This will create a sub-folder with the name of the repo and download everything for you into it (e.g. `C:\repos\YOUR-REPO\`)
179
- 5. Still in the command prompt, execute `cd YOUR-REPO`. This will switch your current folder (visible before the command prompt) to the new repo folder (`C:\repos\YOUR-REPO\`).
180
- 6. Assuming you installed Accenture SFMC DevTools globally (recommended!), now execute `mcdev init`.
181
- 7. At this point, the system will recognize the previously set up project and ask you for `EID (Parent MID)`, `Client ID`, `Client Secret` and the `Authentication Base URI`.
182
- 8. Done.
183
-
184
- ### 2.5. Recommended additional installs
185
-
186
- <a id="markdown-recommended-additional-installs" name="recommended-additional-installs"></a>
187
-
188
- The following seeks to enhance your daily process. Our guide assumes that you are using [Visual Studio Code](https://code.visualstudio.com/download) to develop, backup and deploy your project. For smooth operations, we highly recommend the following Marketing Cloud specific plugins for it.
189
-
190
- Nevertheless, Accenture SFMC DevTools will run without them and is not associated with the development of these publicly available apps & plugins.
191
-
192
- > **Note:** The following lists are automatically installed when you run `mcdev init` or `mcdev upgrade`.
193
-
194
- **Visual Studio Code extensions:**
195
-
196
- When you run `mcdev init` or `mcdev upgrade` we add/update the file `.vscode/extensions.json` in your project directory with a list of recommended VSCode extensions that will help your daily workflow with Salesforce Marketing Cloud.
197
-
198
- Restart VS Code after cloning a prepared repo or after you've run `init` / `upgrade` and VS Code will prompt you in the lower right corner with:
199
-
200
- ![Recommended extension prompt](img/README.md/vscode-recommendations-1.png)
201
-
202
- Click on `Install All` to quickly get things ready or review the recommendations first via `Show Recommendations`. If you opt for the second option, be aware that there are 2 kinds of recommendations:
203
-
204
- ![Recommended extension prompt](img/README.md/vscode-recommendations-2.png)
205
-
206
- The "Workspace Recommendations" were defined by Accenture SFMC DevTools. Clicking on the little cloud icon will install all at once. The "Other Recommendations" are auto-generated by VS Code and are not controlled by Accenture SFMC DevTools. You _may_ look through those as well, but they might also be completely irrelevant to you.
207
-
208
- **Node modules:**
209
-
210
- - [eslint](https://npmjs.com/package/eslint): code linting
211
- - [eslint-config-prettier](http://npmjs.com/package/eslint-config-prettier): ensures that prettier and eslint do not have conflicting rules
212
- - [eslint-config-ssjs](http://npmjs.com/package/eslint-config-ssjs): allows you to have accurate code linting in \*.SSJS files
213
- - [eslint-plugin-jsdoc](http://npmjs.com/package/eslint-plugin-jsdoc): will help you write proper jsdoc comments in your SSJS code
214
- - [eslint-plugin-prettier](http://npmjs.com/package/eslint-plugin-prettier): runs prettier and ESlint together
215
- - [prettier](https://prettier.io): opinionated code formatter
216
- - [npm-check](http://npmjs.com/package/npm-check): makes it easier to keep your node modules up-to-date
217
- - [sfmc-boilerplate](http://npmjs.com/package/sfmc-boilerplate): build tool for your more complex email, cloudpage and automation code.
218
-
219
- Please note that Visual Studio Code might warn you about using the local installation of ESLint with a pop-up like the following. Please confirm this with `Allow` or, if you are certain about what you are doing, with `Allow Everywhere`. Inside of Accenture SFMC DevTools project folders this warning is normal because we ask to install the VSCode extension and the node module for ESLint.
220
-
221
- ![VSCode Eslint install warning](img/README.md/vscode-eslint-allow_everywhere.jpg)
222
-
223
- ### 2.6 Using mcdev in other node packages
224
-
225
- Install it locally first via the following (or with a [specific version](#41-installing-specific-version)):
226
-
227
- ```bash
228
- npm install --save mcdev
229
- ```
230
-
231
- And then require it in your code:
232
-
233
- ```javascript
234
- const mcdev = require('mcdev');
235
-
236
- // download all metadata from your instance's Parent BU
237
- mcdev.retrieve('MyCredential/_ParentBU_');
238
-
239
- // or download all metadata from your instance's Parent BU
240
- mcdev.retrieve('MyCredential/_ParentBU_', 'dataExtension');
241
- ```
242
-
243
- For more details on the available methods look out for what Intellisense will return or refer to the [developer documentation](docs/dist/documentation.md).
244
-
245
- <a name="updating-mcdev"></a>
246
-
247
- ## 3. Updating Accenture SFMC DevTools
248
-
249
- <a id="markdown-updating-accenture-sfmc-devtools" name="updating-accenture-sfmc-devtools"></a>
250
-
251
- If you have mcdev already installed you can update your installation in a simplified way:
252
-
253
- ```bash
254
- npm update -g mcdev
255
- ```
256
-
257
- <a name="troubleshoot-installupdate"></a>
258
-
259
- ## 4. Troubleshoot Install/Update
260
-
261
- <a id="markdown-troubleshoot-install%2Fupdate" name="troubleshoot-install%2Fupdate"></a>
262
-
263
- ### 4.1. Installing a specific version
264
-
265
- <a id="installing-specific-version" name="installing-specific-version"></a>
266
-
267
- To work with our **developer-version** or to install a **specific older version** you can select any branch or tag from our git repository during install to do so:
268
-
269
- **Most recent developer version (using the GitHub repo & branch name):**
270
-
271
- ```bash
272
- npm install -g accenture/sfmc-devtools#develop
273
- ```
274
-
275
- _Note: Regardless of which tag or branch you install_
276
-
277
- **Install specific version (using a version tag on npm):**
278
-
279
- ```bash
280
- npm install -g mcdev@4.1.12
281
- ```
282
-
283
- **Warning**: When you used the above method to install Accenture SFMC DevTools for a specific version or tag, trying to [update Accenture SFMC DevTools](#updating-mcdev) might not download the most recently published official version but instead stay on the version or branch you previously selected (in the above examples: develop, 4.1.12)!
284
-
285
- > **Note**: The version is currently _not_ updated on the developer branch until a new release is published. Hence, you will not see a change if you run `mcdev --version`.
286
-
287
- ### 4.2. Using custom CLIs
288
-
289
- <a id="markdown-using-custom-clis" name="using-custom-clis"></a>
290
-
291
- Some users of Accenture SFMC DevTools prefer to use git bash or other CLIs instead of the operating system's default. Please note that some of the functionality of Accenture SFMC DevTools but also other tools like the Node package manager (npm) do not necessarily function properly in these.
292
-
293
- If you encounter problems, we strongly recommend first trying it in the default CLI.
294
-
295
- <a name="missing-write-access-toon-macos"></a>
296
-
297
- ### 4.3. Missing write access to...on MacOS
298
-
299
- <a id="markdown-missing-write-access-to...on-macos" name="missing-write-access-to...on-macos"></a>
300
-
301
- Depending on your setup, the default global installs & updates might error out with "Missing write access to /usr/local/lib/node_modules". In this case, prefix your command with `sudo`:
302
-
303
- ```bash
304
- sudo npm install -g mcdev
305
- ```
306
-
307
- ```bash
308
- sudo npm update -g mcdev
309
- ```
310
-
311
- ![Mac sudo](img/README.md/troubleshoot-mac-sudo.png)
312
-
313
- ### 4.4. ...running scripts is disabled on this system
314
-
315
- <a id="markdown-...running-scripts-is-disabled-on-this-system" name="...running-scripts-is-disabled-on-this-system"></a>
316
-
317
- If you see the below error then your system's security settings are rather strict.
318
-
319
- ![Execution Policy](img/README.md/troubleshoot-execution_policy.jpg)
320
-
321
- Steps to solve this:
322
-
323
- 1. Start Windows PowerShell with the "Run as Administrator" option.
324
- 2. Input the following and then hit ENTER: `set-executionpolicy remotesigned`
325
- 3. This will likely show a lengthy message with a question to confirm the change (screenshot below). Please type `y` (="yes") and confirm with `Enter`.
326
-
327
- ![Execution Policy](img/README.md/troubleshoot-execution_policy-2.png)
328
-
329
- Please note that this change is global and not just for your current folder.
330
-
331
- ### 4.5. Operation not permitted OR No such file or directory
332
-
333
- <a id="markdown-operation-not-permitted-or-no-such-file-or-directory" name="operation-not-permitted-or-no-such-file-or-directory"></a>
334
-
335
- If you encounter out of the 3 following errors you will have to completely remove Node.JS and install it again afterwards.
336
-
337
- **Error 1:** Cannot find module index.js
338
-
339
- ![index.js not found](img/README.md/troubleshoot-nodejs-index.jpg)
340
-
341
- **Error 2:** Operation not permitted
342
-
343
- ![operation not permitted](img/README.md/troubleshoot-nodejs-permission.jpg)
344
-
345
- **How to completely remove Node.js from Windows:**
346
-
347
- 1. Run npm cache clean --force
348
-
349
- 2. Uninstall it via the system's `Add or remove programs` (find it by searching in the start menu).
350
-
351
- 3. Reboot your computer.
352
-
353
- 4. Look for these folders and remove them (and their contents) if any still exist. Depending on the version you installed, UAC settings, and CPU architecture, these may or may not exist:
354
-
355
- - C:\Program Files (x86)\Nodejs
356
- - C:\Program Files\Nodejs
357
- - C:\Users\\{User}\AppData\Roaming\npm
358
- - (or %appdata%\npm)
359
- - C:\Users\\{User}\AppData\Roaming\npm-cache
360
- - (or %appdata%\npm-cache)
361
- - C:\Users\\{User}\.npmrc (and possibly check for that without the . prefix too)
362
- - C:\Users\\{User}\npmrc
363
- - C:\Users\\{User}\AppData\Local\Temp\npm-\*
364
-
365
- 5. Check your %PATH% environment variable to ensure no references to Nodejs or npm exist.
366
-
367
- 6. If it's still not uninstalled, type `where node` at the command prompt and you'll see where it resides -- delete that (and probably the parent directory) too.
368
-
369
- 7. Reboot again!
370
-
371
- **Re-install Node.js and Accenture SFMC DevTools:**
372
-
373
- Now, please follow the guides above in the [Pre-requisites](#pre-requisites) section to Install Node.js again and afterwards try again to [install Accenture SFMC DevTools](#install-mcdev).
12
+ ## Quick start
374
13
 
375
- <a name="metadata-type-support"></a>
14
+ ### Install
376
15
 
377
- ## 5. Metadata Type Support
378
-
379
- <a id="markdown-metadata-type-support" name="metadata-type-support"></a>
380
-
381
- The following metadata types are currently supported:
382
-
383
- | MetadataType | CLI Argument | Retrieve | Deploy | Template | Retrieved by Default | Description |
384
- | ---------------------------------- | ------------------------- | -------- | ---------- | ---------- | -------------------- | ------------------------------------------------------------------------------------------------------------------ |
385
- | API Discovery | `discovery` | Yes | - | - | - | Description of all API endpoints accessible via REST API; only relevant for developers of Accenture SFMC DevTools. |
386
- | Asset | `asset` | Yes | Yes | Yes | Yes | Assets from Content Builder grouped into subtypes. |
387
- | Automation | `automation` | Yes | Yes | Yes | Yes | Used via Automation Studio directly - or indirectly via Journey Builder & MC Connect. |
388
- | Automation: Data Extract Activity | `dataExtract` | Yes | Yes | Yes | Yes | Creates zipped files in your FTP directory or convert XML into CSV. |
389
- | Automation: File Transfer Activity | `fileTransfer` | Yes | Yes | Yes | Yes | Unzip, decrypt a file or move a file from secure location into FTP directory. |
390
- | Automation: Filter Activity | `filter` | Beta | in backlog | in backlog | - | Part of how filtered Data Extensions are created. Depends on type "FilterDefinitions". |
391
- | Automation: Import File Activity | `importFile` | Yes | Yes | Yes | Yes | Reads files in FTP directory for further processing. |
392
- | Automation: SQL Query Activity | `query` | Yes | Yes | Yes | Yes | Select & transform data using SQL. |
393
- | Automation: Script Activity | `script` | Yes | Yes | Yes | Yes | Execute more complex tasks via SSJS or AMPScript. |
394
- | Campaign Tag | `campaign` | Yes | in backlog | in backlog | Yes | Way of tagging/categorizing emails, journeys and alike. |
395
- | Content Area (Classic) | `contentArea` | Yes | - | - | - | **DEPRECATED**: Old way of saving Content Blocks; please migrate these to new Content Blocks (`Asset: ...`). |
396
- | Data Designer Attribute Groups | `attributeGroup` | Beta | in backlog | in backlog | - | Groupings of Set Definitions (Data Extensions) in Data Designer. |
397
- | Data Designer Set Definitions | `setDefinition` | Beta | in backlog | in backlog | - | Data Extensions linked to Attribute Groups in Data Designer. |
398
- | Data Extension | `dataExtension` | Yes | Yes | Yes | Yes | Database table schemas. |
399
- | Data Extension Template | `dataExtensionTemplate` | Yes | - | - | - | OOTB Database table schemas used for special cases like Transactional Journeys. |
400
- | Data Extract Type | `dataExtractType` | Yes | - | - | - | Types of Data Extracts enabled for a specific business unit. This normally should not be stored. |
401
- | E-Mail (Classic) | `email` | Yes | - | - | - | **DEPRECATED**: Old way of saving E-Mails; please migrate these to new E-Mail (`Asset: message`). |
402
- | E-Mail Send Definition | `emailSendDefinition` | Yes | Yes | yes (`bt`) | Yes | Mainly used in Automations as "Send Email Activity". |
403
- | Folder | `folder` | Yes | Yes | yes (`bt`) | - | Used to structure all kinds of other metadata. |
404
- | FTPLocation | `ftpLocation` | Yes | - | - | Yes | A File Location which can be used for export or import of files to/from Marketing Cloud. |
405
- | Journey | `interaction` | Yes | in backlog | in backlog | - | Journey from Builder (internally called "Interaction"). |
406
- | Journey: Entry Event Definition | `eventDefinition` | Yes | Yes | Yes | - | Used in Journeys (Interactions) to define Entry Events. |
407
- | List | `list` | Yes | in backlog | - | Yes | Old way of storing data. Still used for central Email Subscriber DB. |
408
- | Mobile Connect Code | `mobileCode` | Yes | No | No | - | Mobile Connect Shore or Long Codes used for sending. First 50 per BU are retrieved |
409
- | Mobile Connect Keyword | `mobileKeyword` | Yes | Yes | Yes | - | Mobile Connect keywords configured within the Business UNit. First 50 per BU are retrieved |
410
- | Role | `role` | Yes | Yes | yes (`bt`) | Yes | User Roles define groups that are used to grant users access to SFMC systems. |
411
- | Triggered Send | `triggeredSendDefinition` | Yes | Yes | - | Yes | **DEPRECATED**: Sends emails via API or DataExtension Event. |
412
- | User | `accountUser` | Yes | in backlog | - | - | Users and Installed Packages including their assigned Roles, BUs and personal permissions |
413
-
414
- ## 6. Command Overview
415
-
416
- <a id="markdown-command-overview" name="command-overview"></a>
417
-
418
- If you installed mcdev globally as described above you can run mcdev in any directory. See our [install Accenture SFMC DevTools](#install-mcdev) chapter for more details.
419
-
420
- _Example (global install):_
421
-
422
- ```bash
423
- mcdev retrieve
424
- ```
425
-
426
- If you installed Accenture SFMC DevTools as a local dependency (**not recommended**) to the current directory then you will have to add `npx` in front of each command. See our [Local install](#local-install) chapter for more details.
427
-
428
- _Example (local install):_
429
-
430
- ```bash
431
- npx mcdev retrieve
432
- ```
433
-
434
- The following description will assume a global installation for simplicity reasons.
435
-
436
- _Note:_ Parameters listed below in between square brackets = `[...]` are optional parameters. Required parameters are listed in between less-than / greater-than signs = `<...>`.
437
-
438
- _Note:_ Credentials and Business Unit names can always be selected interactively. Try inputting a question mark = `?` in their place if more parameters follow, or omit them completely if no other parameters are required for a command.
439
-
440
- ### 6.1. Maintenance and setup commands
441
-
442
- <a id="markdown-maintenance-and-setup-commands" name="maintenance-and-setup-commands"></a>
443
-
444
- #### 6.1.1. init
445
-
446
- <a id="markdown-init" name="init"></a>
447
-
448
- _Command:_ `mcdev init`
449
-
450
- _Alias:_ -
451
-
452
- Creates the basic configuration file `.mcdevrc.json` and `.mcdev-auth.json` in your project directory. You may add more credentials by re-running the same command again, e.g. to add production and sandbox credentials next to each other.
453
-
454
- In addition, it initializes an npm package for you, installs recommended npm dependencies and places our default IDE configuration files for ESLint, Prettier, Git and VSCode into your project directory.
455
-
456
- The initialization ends with the creation of your Git repository and the first backup of your SFMC instance.
457
-
458
- _Example - initialize project / add additional credentials:_
459
-
460
- ```bash
461
- mcdev init
462
- ```
463
-
464
- _Example - update credentials:_
465
-
466
- ```bash
467
- mcdev init yourCredentialName
468
- ```
469
-
470
- The interactive setup will ask you for an `EID (Parent MID)`, `Client ID` and `Client Secret` of an installed package. It also asks for the `Authentication Base Uri`. Each installed package on a given SFMC instance shares the same tenant sub-domain and always shows you 3 domains (Auth, REST and SOAP).
471
-
472
- Example URL: `https://mcg123abcysykllg-0321cbs8bbt64.auth.marketingcloudapis.com`
473
-
474
- > **Note to CLI experts:**
475
- >
476
- > You can run this command without the interactive wizard asking questions using the `--skipInteraction` (or short`--yes`/`--y`) flag. In this case, you need to provide a few values in the command:
477
- >
478
- > ```bash
479
- > mcdev init --y.credentialName "yourCustomCredentialName" --y.client_id "yourClientIdHere" --y.client_secret "yourClientSecretHere" --y.auth_url "https://yourTenantSubdomainHere.auth.marketingcloudapis.com/" --y.gitRemoteUrl "https://my.git.server.com/myrepo.git" --y.account_id 00000000 --y.downloadBUs "true" --y.gitPush "true"
480
- > ```
481
-
482
- | CLI Argument | Description |
483
- | -------------------- | ---------------------------------------- |
484
- | `--y.credentialName` | Credential name of your Business Unit |
485
- | `--y.client_id` | Salesforce Marketing Cloud client ID |
486
- | `--y.client_secret` | Salesforce Marketing Cloud client secret |
487
- | `--y.auth_url` | Marketing cloud auth url |
488
- | `--y.gitRemoteUrl` | URL of your git remote repo |
489
- | `--y.account_id` | MID of the parent BU |
490
- | `--y.downloadBUs` | Download all the BUs: `true` or `false` |
491
- | `--y.gitPush` | Do the first git push: `true` or `false` |
492
-
493
- #### 6.1.2. upgrade
494
-
495
- <a id="markdown-upgrade" name="upgrade"></a>
496
-
497
- _Command:_ `mcdev upgrade`
498
-
499
- _Alias:_ `mcdev up`
500
-
501
- This upgrades older Accenture SFMC DevTools projects to the newest standard: Outdated Accenture SFMC DevTools configuration files are upgraded and the right npm dependencies are installed. It also copies the right IDE configuration files into your project folder. See [init](#init) for more details.
502
-
503
- _Example:_
504
-
505
- ```bash
506
- mcdev upgrade
507
- ```
508
-
509
- #### 6.1.3. reloadBUs
510
-
511
- <a id="markdown-reloadbus" name="reloadbus"></a>
512
-
513
- _Command:_ `mcdev reloadBUs [credential]`
514
-
515
- _Alias:_ `mcdev rb`
516
-
517
- Use this to synchronize your local list of available Business Units for a given credential. This is useful if you've added, deleted or renamed Business Units on your SFMC instance and want to make sure that your local setup reflects that - or if you accidentally changed your config file and want to restore it.
518
-
519
- _Example:_
520
-
521
- ```bash
522
- mcdev reloadBUs MyProject
523
- ```
524
-
525
- #### 6.1.4. badKeys
526
-
527
- <a id="markdown-badkeys" name="badkeys"></a>
528
-
529
- _Command:_ `mcdev badKeys [business unit]`
530
-
531
- _Alias:_ -
532
-
533
- Lists all metadata for which the External key is not in sync with the name to enable you to update them quickly.
534
-
535
- _Example:_
536
-
537
- ```bash
538
- mcdev badKeys MyProject/DEV
539
- ```
540
-
541
- #### 6.1.5. document
542
-
543
- <a id="markdown-document" name="document"></a>
544
-
545
- _Command:_ `mcdev document <business unit> <TYPE>`
546
-
547
- _Alias:_ `mcdev doc`
548
-
549
- Creates human-readable documentation for your metadata. This command is executed by default for supported types unless you changed your config manually (`metaDataTypes.documentOnRetrieve`). Therefore, running it manually is typically not required. You can choose to generate **HTML** (`html`) or **Markdown** (`md`) docs via `options.documentType`.
550
-
551
- The default format is set to `md` as Markdown renders nicely in Git as well as in VSCode's Markdown preview and can be copied from there into Confluence and other applications without losing the formatting.
552
-
553
- As standard roles are often not used by projects, we have the optional setting `options.documentStandardRoles` which is by default set to false
554
-
555
- Currently supported types:
556
-
557
- | Name | CLI Argument |
558
- | -------------- | --------------- |
559
- | Automation | `automation` |
560
- | Data Extension | `dataExtension` |
561
- | Role | `role` |
562
- | User | `accountUser` |
563
-
564
- _Example:_
565
-
566
- ```bash
567
- mcdev document myServer role
568
- ```
569
-
570
- #### 6.1.6. selectTypes
571
-
572
- <a id="markdown-selecttypes" name="selecttypes"></a>
573
-
574
- _Command:_ `mcdev selectTypes`
575
-
576
- _Alias:_ `mcdev st`
577
-
578
- Allows you to interactively select which metadata is retrieved when you run the `retrieve` command. Try out `explainTypes` first to understand what each type means.
579
-
580
- _Example:_
581
-
582
- ```bash
583
- mcdev selectTypes
584
- ```
585
-
586
- _Note:_ You may select non-standard types if you run `mcdev selectTypes --debug`. This may be needed in edge cases but is not recommended in most situations.
587
-
588
- #### 6.1.7. explainTypes
589
-
590
- <a id="markdown-explaintypes" name="explaintypes"></a>
591
-
592
- _Command:_ `mcdev explainTypes`
593
-
594
- _Alias:_ `mcdev et`
595
-
596
- A helper command for `selectTypes`. It prints out a table that defines what the various types are.
597
-
598
- Types marked as not-default should be ignored. These are either under development or merely meant to support contributing to Accenture SFMC DevTools.
599
-
600
- _Example:_
16
+ Run the following to install Accenture SFMC DevTools on your computer:
601
17
 
602
18
  ```bash
603
- mcdev explainTypes
19
+ npm install -g mcdev
604
20
  ```
605
21
 
606
- ### 6.2. Operational commands
22
+ ### Include in your package
607
23
 
608
- <a id="markdown-operational-commands" name="operational-commands"></a>
609
-
610
- #### 6.2.1. retrieve
611
-
612
- <a id="markdown-retrieve" name="retrieve"></a>
613
-
614
- _Command:_ `mcdev retrieve [business unit] [metadata type] [metadata key]`
615
-
616
- _Alias:_ `mcdev r`
617
-
618
- Retrieves all metadata from the specified Business Unit. You can limit what types are retrieved by default using the `selectTypes` command or by changing the list in the config file directly.
619
-
620
- _Example:_
621
-
622
- ```bash
623
- mcdev retrieve MyProject/DEV
624
- ```
625
-
626
- You can omit the Business Unit which will trigger an interactive mode based on your config:
627
-
628
- _Example:_
629
-
630
- ```bash
631
- mcdev retrieve
632
- ```
633
-
634
- If you already know the credentials name but want to only select the Business Unit interactively try this
635
- _Example:_
636
-
637
- ```bash
638
- mcdev retrieve MyProject
639
- ```
640
-
641
- **retrieve specific type:**
642
-
643
- If you want to retrieve only a certain metadata type, let's say `script`, then pass this type in as a second parameter. The other types will remain untouched and in place, if you've previously retrieved them.
644
-
645
- Similarly, you can pass in multiple comma-separated types but make sure to put them in double quotes to work on all systems.
646
-
647
- _Example:_
24
+ First, install it as dependency:
648
25
 
649
26
  ```bash
650
- mcdev retrieve MyProject/DEV script
651
- mcdev retrieve MyProject/DEV "script,query,automation"
27
+ npm install mcdev --save
652
28
  ```
653
29
 
654
- **retrieve specific type and key:**
655
-
656
- If you wish you may also specify the exact keys that need to be retrieved, filtering down on what's in your retrieve folder even further. Specified keys apply as a filter for all types you specify. If your naming convention does not allow for such an aggregation then please run separate commands for each type.
657
-
658
- _Example:_
30
+ You can then include it in your code with:
659
31
 
660
- ```bash
661
- mcdev retrieve MyProject/DEV dataExtension "key1"
662
- mcdev retrieve MyProject/DEV dataExtension "key1,key2"
663
- mcdev retrieve MyProject/DEV "script,dataExtension,importFile" "key1,key2"
32
+ ```javascript
33
+ const mcdev = require('mcdev');
664
34
  ```
665
35
 
666
- _Note:_ This is not supported by types `discovery` and `folder`.
667
-
668
- **retrieve all BUs:**
36
+ That will load `node_packages/mcdev/lib/index.js`. It can make sense to directly include other files if you have a special scenario. We've done that in our example for [retrieveChangelog.js](https://github.com/Accenture/sfmc-devtools/blob/main/lib/retrieveChangelog.js) or in more detail, in our child-project [sfmc-devtools-copado](https://github.com/Accenture/sfmc-devtools-copado) to get full control over certain aspects.
669
37
 
670
- A special variant of this command allows you to retrieve all Business Units of a given credential at once.
671
- _Example:_
38
+ ## Documentation
672
39
 
673
- ```bash
674
- mcdev retrieve MyProject/*
675
- ```
40
+ Please checkout the [GitHub wiki](https://github.com/Accenture/sfmc-devtools/wiki) for the full documentation.
676
41
 
677
- or even
42
+ ## Changelog
678
43
 
679
- ```bash
680
- mcdev retrieve "*"
681
- ```
44
+ Find info on the latest releases with a detailed changelog in the [GitHub Releases tab](https://github.com/Accenture/sfmc-devtools/releases).
682
45
 
683
- > Note: retrieve-all will fail in some CLIs if you do not wrap the asterix (\*) in quotes. This is due to the special meaning of \* as a parameter in these CLIs.
684
-
685
- #### 6.2.2. deploy
686
-
687
- <a id="markdown-deploy" name="deploy"></a>
688
-
689
- _Command:_ `mcdev deploy [business unit] [metadata type] [metadata key] [deploy from retrieve]`
690
-
691
- _Alias:_ `mcdev d`
692
-
693
- Deploys metadata to the specified Business Unit.
694
- _Example:_
695
-
696
- ```bash
697
- mcdev deploy MyProject/DEV
698
- ```
699
-
700
- Only metadata that you copied into the **deploy** directory will be deployed. Please keep in mind that the folder structure needs to be similar to what the retrieve command creates in the retrieve folder, including the credentials and Business Unit name.
701
-
702
- Similarly to `mcdev retrieve` you can also use the interactive mode to select credential and/or Business Unit.
703
-
704
- **deploy sepcific type:**
705
-
706
- If you want to deploy only a certain metadata type, let's say `dataExtension`, then pass this type in as a second parameter. If there are other types in the current BU's deploy folder, these will be ignored and hence _not_ uploaded.
707
-
708
- Similarly, you can pass in multiple comma-separated types but make sure to put them in double quotes to work on all systems.
709
-
710
- _Example:_
711
-
712
- ```bash
713
- mcdev deploy MyProject/DEV dataExtension
714
- mcdev deploy MyProject/DEV "script,dataExtension,importFile"
715
- ```
716
-
717
- **deploy specific type and key:**
718
-
719
- If you wish you may also specify the exact keys that need to be deployed, filtering down on what's in your deploy folder even further. Specified keys apply as a filter for all types you specify. If your naming convention does not allow for such an aggregation then please run separate commands for each type.
720
-
721
- _Example:_
722
-
723
- ```bash
724
- mcdev deploy MyProject/DEV dataExtension "key1"
725
- mcdev deploy MyProject/DEV dataExtension "key1,key2"
726
- mcdev deploy MyProject/DEV "script,dataExtension,importFile" "key1,key2"
727
- ```
728
-
729
- **deploy from retrieve folder:**
730
-
731
- Sometimes it's convenient to deploy right from the retrieve folder when you are using mcdev as a developer tool rather than only for deployments to other BUs. For this scenario we added the 4th parameter. In that case, it does not look into `deploy/` but into `retrieve/` finding what it needs to deploy.
732
-
733
- _Example:_
734
-
735
- ```bash
736
- mcdev deploy MyProject/DEV dataExtension "key1" true
737
- mcdev deploy MyProject/DEV dataExtension "key1,key2" true
738
- mcdev deploy MyProject/DEV "script,dataExtension,importFile" "key1,key2" true
739
- ```
740
-
741
- **deploy all BUs:**
742
-
743
- A special variant of this command allows you to deploy all Business Units of a given credential at once.
744
- _Example:_
745
-
746
- ```bash
747
- mcdev deploy MyProject/*
748
- ```
749
-
750
- or even
751
-
752
- ```bash
753
- mcdev deploy "*"
754
- ```
755
-
756
- > Note: deploy-all will fail in some CLIs if you do not wrap the asterix (\*) in quotes. This is due to the special meaning of \* as a parameter in these CLIs.
757
-
758
- #### 6.2.3. delete
759
-
760
- <a id="markdown-delete" name="delete"></a>
761
-
762
- _Command:_ `mcdev delete <business unit> <type> <external key>`
763
-
764
- _Alias:_ `mcdev del`
765
-
766
- Deletes the given metadata from your server. This needs to be run with care as any **data** stored in the deleted _meta_-data **will be lost**.
767
-
768
- Currently supported types:
769
-
770
- | Name | CLI Argument |
771
- | --------------------- | ------------------------- |
772
- | Data Extension | `dataExtension` |
773
- | Data Extension Field | `dataExtensionField` |
774
- | Email Send Definition | `Email Send Definition` |
775
- | List | `list` |
776
- | Triggered Send | `triggeredSendDefinition` |
777
-
778
- _Example:_
779
-
780
- ```bash
781
- mcdev delete MyProject/_ParentBU_ dataExtension MyUserTable
782
-
783
- mcdev delete MyProject/_ParentBU_ dataExtensionField MyUserTable.MyFieldName
784
- ```
785
-
786
- #### 6.2.4. retrieveAsTemplate
787
-
788
- <a id="markdown-retrieveastemplate" name="retrieveastemplate"></a>
789
-
790
- _Command:_ `mcdev retrieveAsTemplate <business unit> <type> <name> <market>`
791
-
792
- _Alias:_ `mcdev rt`
793
-
794
- The `rt` command retrieves metadata from the server and uses your `market` configuration in `.mcdevrc.json` to replace strings with variables. The result is then stored in your `template/` folder. Please note that files stored here will keep their original name, despite this possibly containing market-specific suffixes or similar. Also note, that contrary to the deploy & retrieve folders, you will not see credential- or Business Unit-sub-folders here.
795
-
796
- This command is a prerequisite for the `buildDefintion` command. Alternatively, you can copy-paste retrieved metadata from your `retrieve/` folder to your `template/` folder and update it manually - or even create it from scratch.
797
-
798
- > **Note**: Before using this command, you need to configure your markets first! Check out our guide on [Market Configuration](#market-configuration) to understand how to use templating and prepare your market config.
799
-
800
- Currently supported types: Check out [Metadata Type Support](#metadata-type-support).
801
-
802
- _Example:_
803
-
804
- ```bash
805
- mcdev rt MyProject/DEV dataExtension MyUserTable pilotMarketDEV1
806
- ```
807
-
808
- This will result in `MyUserTable.dataExtension-meta.json` being created in your `template/` directory:
809
-
810
- **retrieveAsTemplate for multiple sources:**
811
-
812
- You can also create multiple templates with multiple sources at once. Simply specify them in a comma-separated list and put that list in quotes:
813
-
814
- ```bash
815
- mcdev rt MyProject/DEV dataExtension "table1,table2,table3" pilotMarketDEV1
816
- ```
817
-
818
- This will result in the following files being created in your `template/` directory:
819
-
820
- - `table1.dataExtension-meta.json`
821
- - `table2.dataExtension-meta.json`
822
- - `table3.dataExtension-meta.json`
823
-
824
- #### 6.2.5. buildTemplate
825
-
826
- <a id="markdown-buildtemplate" name="buildtemplate"></a>
827
-
828
- _Command:_ `mcdev buildTemplate <business unit> <type> <name> <market>`
829
-
830
- _Alias:_ `mcdev bt`
831
-
832
- The `bt` command uses previously retrieved metadata on your local computer and uses your `market` configuration in `.mcdevrc.json` to replace strings with variables. The result is then stored in your `template/` folder. Please note that files stored here will keep their original name, despite this possibly containing market-specific suffixes or similar. Also note, that contrary to the deploy & retrieve folders, you will not see credential- or Business Unit-sub-folders here.
833
-
834
- This command is a prerequisite for the `buildDefintion` command. Alternatively, you can copy-paste retrieved metadata from your `retrieve/` folder to your `template/` folder and update it manually - or even create it from scratch.
835
-
836
- > **Note**: Before using this command, you need to configure your markets first! Check out our guide on [Market Configuration](#market-configuration) to understand how to use templating and prepare your market config.
837
-
838
- Currently supported types: Check out [Metadata Type Support](#metadata-type-support).
839
-
840
- _Example:_
841
-
842
- ```bash
843
- mcdev bt MyProject/DEV dataExtension MyUserTable pilotMarketDEV1
844
- ```
845
-
846
- This will result in `MyUserTable.dataExtension-meta.json` being created in your `template/` directory:
847
-
848
- **buildTemplate for multiple sources:**
849
-
850
- You can also create multiple templates with multiple sources at once. Simply specify them in a comma-separated list and put that list in quotes:
851
-
852
- ```bash
853
- mcdev bt MyProject/DEV dataExtension "table1,table2,table3" pilotMarketDEV1
854
- ```
855
-
856
- This will result in the following files being created in your `template/` directory:
857
-
858
- - `table1.dataExtension-meta.json`
859
- - `table2.dataExtension-meta.json`
860
- - `table3.dataExtension-meta.json`
861
-
862
- #### 6.2.6. buildDefinition
863
-
864
- <a id="markdown-builddefinition" name="builddefinition"></a>
865
-
866
- _Command:_ `mcdev buildDefinition <business unit> <type> <name> <market>`
867
-
868
- _Alias:_ `mcdev bd`
869
-
870
- The `buildDefinition` command allows to prepare the deployments to one or multiple targets based on templates and [Market Configuration](#market-configuration).
871
- After you have created your templates via `retrieveAsTemplate` (or manually) in your `template/dataExtension/` folder run this command to create the final deployable files in your respective `retrieve/<business unit>/` folder.
872
-
873
- This allows you to double-check if you changed something by comparing the before and after using your favorite Git client. You then have to manually copy the files you want to deploy into the respective `deploy/` folder.
874
-
875
- > **Note**: Before using this command, you need to configure your markets first! Check out our guide on [Market Configuration](#market-configuration) to understand how to use templating and prepare your market config.
876
-
877
- Currently supported types: Check out [Metadata Type Support](#metadata-type-support).
878
-
879
- _Example:_
880
-
881
- ```bash
882
- mcdev bd MyProject/QA dataExtension MyUserTable pilotMarketQA1
883
- ```
884
-
885
- This will result in the following files being created in your `retrieve/MyProject/QA/dataExtension/` directory:
886
-
887
- - `MyUserTable.dataExtension-meta.json`
888
-
889
- **buildDefinition for multiple sources:**
890
-
891
- You can also create definitions based on multiple templates at once. Simply specify them in a comma-separated list and put that list in quotes:
892
-
893
- ```bash
894
- mcdev bd MyProject/QA dataExtension "table1,table2,table3" pilotMarketDEV1
895
- ```
896
-
897
- This will result in the following files being created in your `retrieve/MyProject/QA/dataExtension/` directory:
898
-
899
- - `table1.dataExtension-meta.json`
900
- - `table2.dataExtension-meta.json`
901
- - `table3.dataExtension-meta.json`
902
-
903
- #### 6.2.7. buildDefinitionBulk
904
-
905
- <a id="markdown-builddefinitionbulk" name="builddefinitionbulk"></a>
906
-
907
- _Command:_ `mcdev buildDefinitionBulk <list name> <type> <name>`
908
-
909
- _Alias:_ `mcdev bdb`
910
-
911
- With `buildDefinitionBulk` you get a very powerful command that wraps around `buildDefinition`, which it executes internally. It allows you to create the definitions for multiple Business Units and multiple markets at once.
912
-
913
- Instead of passing in the name of credentials, Business Units and markets, you simply refer to a pre-defined market list in your `.mcdevrc.json`. This enables you to re-use the same configs over and over again, across multiple deployments and share it with your team.
914
-
915
- **Note**: Before using this command, you need to configure your markets first! Check out our guide on [Market List Configuration](#market-list-configuration) and [Market Configuration](#market-configuration) to understand how to use **bulk** templating and prepare your market config.
916
-
917
- _Example:_
918
-
919
- ```bash
920
- mcdev bdb pilotMarketsQA dataExtension MyUserTable
921
- ```
922
-
923
- #### 6.2.8. createDeltaPkg
924
-
925
- <a id="markdown-createdeltapkg" name="createdeltapkg"></a>
926
-
927
- _Command:_ `mcdev createDeltaPkg [range] [filter]`
928
-
929
- _Alias:_ `mcdev cdp`
930
-
931
- This command is rather versatile and hence can be used in multiple ways. The most powerful option presents itself when you configure `options.deployment.sourceTargetMapping` to point to a source `marketList` (usually for DEV-BU with a DEV market) and a target `marketList` (e.g. to a QA BU-market combo and a Production BU-market combo). Given this is configured, it can create all deployable files using Accenture SFMC DevTools's templating engine on the fly for you.
932
-
933
- The **minimum configuration** you need to have in your config could look something like the following:
934
-
935
- > Note: the following example does not show all necessary parts of the config, just those that are needed for createDeltaPkg.
936
- >
937
- > The example tells createDeltaPkg that the source BU is called `MyProject/DEV` and that the there are two target for deployment, `MyProject/QA` and `MyProject/PROD`. Furthermore it associates the markets `dev`, `qa` and `prod` to these BUs to ensure templating is applied - however, the markets in this example are empty which means no actual string replacement will occur. This is normal for most basic cases in which you would expect 1:1 copies on DEV, QA and PROD.
938
- >
939
- > When MC Connect is used, one would expect to see the External Keys of the Synchronized DataExtensions to be mentioned in the markets for easy auto-replacement.
940
-
941
- ```json
942
- {
943
- "credentials": {
944
- "MyProject": {
945
- "businessUnits": {
946
- "DEV": "1235",
947
- "QA": "1236",
948
- "PROD": "1237"
949
- }
950
- }
951
- },
952
- "options": {
953
- "deployment": {
954
- "commitHistory": 10,
955
- "sourceTargetMapping": {
956
- "deployment-source": "deployment-target"
957
- }
958
- }
959
- },
960
- "directories": {
961
- "deltaPackage": "docs/deltaPackage/",
962
- "deploy": "deploy/",
963
- "retrieve": "retrieve/",
964
- "template": "template/",
965
- "templateBuilds": ["retrieve/", "deploy/"]
966
- },
967
- "markets": {
968
- "dev": {},
969
- "qa": {},
970
- "prod": {}
971
- },
972
- "marketList": {
973
- "deployment-source": {
974
- "description": "Define one 1:1 BU-Market combo here to as source for automated creation of deployment packages; you can create more than one source market list",
975
- "MyProject/DEV": "dev"
976
- },
977
- "deployment-target": {
978
- "description": "Define n BU-Market combo here to as target for automated creation of deployment packages; you can create more than one target market list and they can be as complex as you like",
979
- "MyProject/QA": "qa",
980
- "MyProject/PROD": "prod"
981
- }
982
- }
983
- }
984
- ```
985
-
986
- > **Detailed Background infos:** `createDeltaPkg` internally first compares the 2 commits in Git to find the differences, then executes `retrieveAsTemplate` for all of these found differences, which creates files in your `template/` directory. Finally, it runs `buildDefinitionBulk` for everything, updating your `retrieve/` directory as well as, optionally, your `deploy/` directory, depending on your Accenture SFMC DevTools config's `directories.templateBuilds` value. The update to the first folder enables you to update you branch, while the second folder gives you the right files to immediately deploy to your BUs afterwards (not part of `createDeltaPkg).
987
-
988
- **Interactive commit selection:**
989
-
990
- This allows you to compare your latest commit (**not** what's still only unstaged/staged) with previous commits. This approach is especially useful if you are in charge of the deployment and simply want to compare the latest commits to your master / release branch with the commit that was last deployed.
991
-
992
- > **Important**: Make sure you are on the branch corresponding to the environment you want to deploy to, e.g. the master branch.
993
-
994
- ```bash
995
- mcdev createDeltaPkg
996
- ```
997
-
998
- The output will look something like this:
999
-
1000
- ![interactive commit selection](img/README.md/cdp-1.jpg)
1001
-
1002
- > _Note: The amount of displayed past commits depends on your Accenture SFMC DevTools configs settings in `options.deployment.commitHistory`. The default value is 10._
1003
-
1004
- **Manual commit selection:**
1005
-
1006
- This is what you would do when you work on a feature branch and want to include the proposed changes for the target BUs already in the branch.
1007
-
1008
- ```bash
1009
- # Option 1 - RECOMMENDED
1010
- # compare based on what you last committed
1011
- # you just committed all your changes and want to create the deployment package for master/Production;
1012
- # Recommendation: run this before creating a pull request to include the changes in your PR.
1013
-
1014
- mcdev createDeltaPkg master # resolves to master..HEAD
1015
- ```
1016
-
1017
- Alternatives:
1018
-
1019
- ```bash
1020
- # the same example with another branch name:
1021
- mcdev createDeltaPkg "release/sprint-14" # resolves to release/sprint-14..HEAD
1022
-
1023
- # or even use a commit ID instead of a branch name
1024
- mcdev createDeltaPkg d21b4221 # resolves to d21b4221..HEAD
1025
-
1026
-
1027
- # Option 2 - full git range
1028
- # Treat this option with caution because createDeltaPkg always runs retrieveAsTemplate and hence downloads from your DEV BU, not from the git branch.
1029
- mcdev createDeltaPkg master..develop
1030
- ```
1031
-
1032
- **Manual commit selection without templating:**
1033
-
1034
- If you don't want to use templating, you may instead provide the optional `filter` parameter. This will limit
1035
-
1036
- ```bash
1037
- mcdev createDeltaPkg d21b4221..HEAD 'MyProject/BU1'
1038
- ```
1039
-
1040
- Range and multiple filters (without templating):
1041
-
1042
- ```bash
1043
- mcdev createDeltaPkg d21b4221..HEAD 'MyProject/BU1,MyProject/BU3'
1044
- ```
1045
-
1046
- > **Note to CLI experts:**
1047
- >
1048
- > If you provide a range you can run this command without the interactive wizard asking questions using the `--skipInteraction` (or short`--yes`/`--y`) flag. This will automatically empty your deploy folder before adding new files. Your command will look like this:
1049
- >
1050
- > ```bash
1051
- > mcdev createDeltaPkg <range> [filter] --y
1052
- > ```
1053
-
1054
- ## 7. Advanced Configuration
1055
-
1056
- <a id="markdown-advanced-configuration" name="advanced-configuration"></a>
1057
-
1058
- The tool's configuration can be changed in the file `.mcdevrc.json` located in the root of your project folder.
1059
-
1060
- It contains [Market Configuration](#market-configuration) (`markets: { ... }`), [Market List Configuration](#market-list-configuration) (`marketList: { ... }`) the list of usable Business Units per credentials, `directories`, as well as other `options`.
1061
-
1062
- You will also find the configuration for what metadata shall be retrieved here in `metaDataTypes.retrieve: [ ... ]`.
1063
-
1064
- You will also find a secondary file named `.mcdev-auth.json` containing your credentials. **Do not commit this to your repository!** You should only commit `.mcdevrc.json` as this file contains project-wide settings that do not compromise security.
1065
-
1066
- ### 7.1. Config Options
1067
-
1068
- <a id="markdown-config-options" name="config-options"></a>
1069
-
1070
- The central config in `.mcdevrc.json` holds multiple adjustable settings:
1071
-
1072
- ```json
1073
- {
1074
- "options": {
1075
- "deployment": {
1076
- "commitHistory": 10,
1077
- "sourceTargetMapping": {
1078
- "deployment-source": "deployment-target"
1079
- },
1080
- "targetBranchBuMapping": {
1081
- "release/*": "MySandbox/QA-DE",
1082
- "master": ["MyProduction/PROD-DE", "MyProduction/PROD-NL"]
1083
- }
1084
- },
1085
- "documentType": "md",
1086
- "documentStandardRoles": true,
1087
- "exclude": {
1088
- "role": {
1089
- "CustomerKey": ["excludedRoleKey","excludedOtherRoleKey"]
1090
- }
1091
- },
1092
- "include": {
1093
- "asset": {
1094
- "r__folder_Path": ["Content Builder/only/assets/in/here"]
1095
- },
1096
- },
1097
- "serverTimeOffset": -6
1098
- },
1099
- "directories": {
1100
- "businessUnits": "businessUnits/",
1101
- "deploy": "deploy/",
1102
- "docs": "docs/",
1103
- "retrieve": "retrieve/",
1104
- "template": "template/",
1105
- "templateBuilds": ["retrieve/", "deploy/"]
1106
- },
1107
- "metaDataTypes": {
1108
- "documentOnRetrieve": ["accountUser", "automation", "dataExtension", "role"],
1109
- "retrieve": [...]
1110
- }
1111
- }
1112
- ```
1113
-
1114
- | Setting | Default | Description |
1115
- | ---------------------------------------- | -------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
1116
- | options.deployment.commitHistory | 10 | Configures how many commits `createDeltaPkg` will display if no parameters are given |
1117
- | options.deployment.sourceTargetMapping | `{"deployment-source": "deployment-target"}` | Configuration of 1 or many source-target marketList combos for `mcdev createDeltaPkg` |
1118
- | options.deployment.targetBranchBuMapping | `{"release/*": "...","master": ["..."]}` | Can be used by CI/CD pipelines to know what BUs shall be deployed to upon a merge into one of the specified branches |
1119
- | options.documentType | 'md' | Defines the format for documentation ('md', 'html', 'both') |
1120
- | options.documentStandardRoles | false | Optionally skip standard role documentation by setting to false |
1121
- | options.exclude.`type`.`field` | [] | Allows you to filter out metadata on retrieve based on their field values, e.g. CustomerKey (previously `options.filter`) |
1122
- | options.include.`type`.`field` | [] | Allows you to filter out metadata on retrieve based on their field values, e.g. CustomerKey |
1123
- | options.serverTimeOffset | -6 | Used to work around quirks in how SFMC handles timezones; For stack4: set to -7 (US Mountain time); others: -6 (US Central) |
1124
- | directories.businessUnits | 'businessUnits/' | Directory to save BU base details in |
1125
- | directories.deploy | 'deploy/' | Where `deploy` searches for files to deploy |
1126
- | directories.docs | 'docs/' | Directory for `document` output |
1127
- | directories.retrieve | 'retrieve/' | Where `retrieve` stores downloaded files |
1128
- | directories.template | 'template/' | Where `rt` stores downloaded templates & `bd` retrieves them from |
1129
- | directories.templateBuilds | ['retrieve/','deploy/'] | Where `bd` saves final deployment versions in. This can hold multiple directories, e.g. ['retrieve/','deploy/'] |
1130
- | metaDataTypes.documentOnRetrieve | ['role','dataExtension'] | automatically executes `document` for selected types |
1131
- | metaDataTypes.retrieve | _changes with each release_ | check [Metadata Type Support](#metadata-type-support) for current list |
1132
-
1133
- ### 7.2. Metadata-specific settings & options
1134
-
1135
- <a id="markdown-metadata-specific-settings" name="metadata-specific-settings"></a>
1136
-
1137
- #### 7.2.1. Retention Policy fields in Data Extensions
1138
-
1139
- The way the retention policy is saved is a bit misleading and hence we wanted to provide a bit of guidance if you ever need to do a deep dive here.
1140
-
1141
- | Field | Description | Values |
1142
- | ------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- | ------------ |
1143
- | **DataRetentionPeriod** | this field should print the value of the unit of measure but it unfortunately is off by one (e.g. showing "weeks" instead of "months"). Also, it seems to have no impact on what's stored.<br> We therefore excluded it from retrieve/deploy | - |
1144
- | **DataRetentionPeriodUnitOfMeasure** | represents drop-down for "period after" selection | 6: years<br>5: months<br>4: weeks<br>2: days |
1145
- | **DataRetentionPeriodLength** | represents number field for "period after" selection | min: 1<br>max: 999 |
1146
- | **RowBasedRetention** | only true if "delete individual records" is selected, otherwise false | true / false |
1147
- | **ResetRetentionPeriodOnImport** | true if "Reset period on import" is checked. | This option is always false if "delete individual records" is selected | true / false |
1148
- | **DeleteAtEndOfRetentionPeriod** | true if "delete all records" is selected, otherwise false | true / false |
1149
- | **RetainUntil** | Normally, this should only be filled if a date, rather than a period was set.<br><br>This is empty for "delete individual records", but filled with a (calculated) date for the other 2 delete options even if "period after" was used.<br> Warning: trying to update a DE is denied when "period after" fields & this is provided | ""<br>or date in US format (m/d/Y H:m:s") "12/6/2021 12:00:00 AM") |
1150
-
1151
- To **disable retention completely**, ensure that you have the 3 booleans set to false, RetainUntil set to an empty string and no DataRetentionPeriod set (=those 2 attributes not present in file).
1152
-
1153
- To enable "delete All records and data extensions" you have to set RowBasedRetention:false and DeleteAtEndOfRetentionPeriod:false while at the same time providing a date in RetainUntil field or a DataRetentionPeriod via the 2 associated fields.
1154
-
1155
- It seems the 2 other modes were added on top later and hence "all records and data extension" is the default retention mode.
1156
-
1157
- #### 7.2.2. Adding/Updating Fields on existing Data Extensions
1158
-
1159
- <a id="markdown-8-examples" name="8-examples"></a>
1160
-
1161
- There are a few rules to keep in mind when playing with Data Extensions fields:
1162
-
1163
- - The `FieldType` cannot be changed on existing fields; the API returns in error is the attribute is even provided unchanged during an update
1164
- - `MaxLength` can be increased or kept on the same value but never decreased during an update
1165
- - A Non-Required/Nullable field cannot be set to be required during an UPDATE
1166
- - When new fields are added, they can be required, but then also have to have a `DefaultValue` set
1167
- - The value for `IsRequired` should be 'true' or 'false'
1168
- - The value for `IsPrimary` should be 'true' or 'false'
1169
-
1170
- #### 7.2.3. Renaming fields of a Data Extensions
1171
-
1172
- With a small addition to the Data Extension's JSON, it is possible to rename fields via MC DevTools. Imagine the following Data Extension:
1173
-
1174
- ```json
1175
- {
1176
- "CustomerKey": "Account",
1177
- "Name": "Account",
1178
- "Description": "",
1179
- "IsSendable": "false",
1180
- "IsTestable": "false",
1181
- "Fields": [
1182
- {
1183
- "Name": "BillingCity",
1184
- "Scale": "0",
1185
- "DefaultValue": "",
1186
- "MaxLength": "40",
1187
- "IsRequired": "false",
1188
- "IsPrimaryKey": "true",
1189
- "FieldType": "Text"
1190
- },
1191
- {
1192
- "Name": "BillingCountry",
1193
- "Scale": "0",
1194
- "DefaultValue": "",
1195
- "MaxLength": "80",
1196
- "IsRequired": "false",
1197
- "IsPrimaryKey": "false",
1198
- "FieldType": "Text"
1199
- }
1200
- ],
1201
- "r__folder_Path": "Data Extensions"
1202
- }
1203
- ```
1204
-
1205
- Imagine you wanted to rename `BillingCountry` to `BillingZip` for some reason. Previously, you could either go into the GUI or delete & recreate the field. Now, MC DevTools allows you to specify `Name_new` on the field and the tool will take care of the rest during **deployment**:
1206
-
1207
- ```json
1208
- {
1209
- "CustomerKey": "Account",
1210
- "Name": "Account",
1211
- "Description": "",
1212
- "IsSendable": "false",
1213
- "IsTestable": "false",
1214
- "Fields": [
1215
- {
1216
- "Name": "BillingCity",
1217
- "Scale": "0",
1218
- "DefaultValue": "",
1219
- "MaxLength": "40",
1220
- "IsRequired": "false",
1221
- "IsPrimaryKey": "true",
1222
- "FieldType": "Text"
1223
- },
1224
- {
1225
- "Name": "BillingCountry" /* old name, keep here for reference during the update! */,
1226
- "Name_new": "BillingZip" /* new name */,
1227
- "Scale": "0",
1228
- "DefaultValue": "",
1229
- "MaxLength": "80",
1230
- "IsRequired": "false",
1231
- "IsPrimaryKey": "false",
1232
- "FieldType": "Text"
1233
- }
1234
- ],
1235
- "r__folder_Path": "Data Extensions"
1236
- }
1237
- ```
1238
-
1239
- All you have to do is deploy the data extension again with Name_new specified for each field that needs to be renamed.
1240
-
1241
- ### 7.3. Market Configuration
1242
-
1243
- <a id="markdown-market-configuration" name="market-configuration"></a>
1244
-
1245
- You will want to set up configs for variable parts that change in between Business Units. We advise starting this _after_ you've first run the `retrieveAsTemplate` command. This might sound counterintuitive but when you review what was copied into your template folder you will likely spot these variable parts the fastest and can then start setting up your market config. Please consider this an iterative process as you will likely run `rt` followed by another update of your config multiple times until you got it right.
1246
-
1247
- We advise clustering your logical approach into variable things on the **instance parent** (=`_ParentBU_` in Accenture SFMC DevTools), the **environment parent** (under which you cluster your child Business Units for DEV, QA and PROD respectively), and **child Business Units**. Ideally, the instance parent is only used to deploy _Shared Data Extensions_, the environment parent is used for integrations with external services and to separate incoming data via Automations into the respective _Shared Data Extensions_. The child Business Units are then reserved for everything that is run on a market-by-market basis.
1248
-
1249
- _Note:_ We do see it often that instance parent and environment parent are the same. This is depending on your client's setup since Business Units are not for free and clients sometimes decide to save the extra money. Sometimes, you even end up with only one BU for DEV activities, no QA environment - and share the instance parent between DEV and production... This is not the recommended approach for multiple reasons, including security, but it is the reality in some of our projects.
1250
-
1251
- Here is a simple example with one DEV BU, 1 QA BU and 2 PROD BUs:
1252
-
1253
- ```json
1254
- // example market config in your .mcdevrc.json
1255
- "markets": {
1256
- "DEV-NL": {
1257
- "mid": "12345",
1258
- "buName": "DEV - Child NL",
1259
- "sharedFolder": "/Shared Data Extensions/DEV/NL",
1260
- "suffix": "_DEV_NL",
1261
- "countryCodeIn": "'NL'"
1262
- },
1263
- "QA-DE": {
1264
- "mid": "12346",
1265
- "buName": "QA - Child DE",
1266
- "sharedFolder": "/Shared Data Extensions/QA/DE",
1267
- "suffix": "_QA_DE",
1268
- "countryCodeIn": "'DE'"
1269
- },
1270
- "PROD-DE": {
1271
- "mid": "12349",
1272
- "buName": "DE - Germany",
1273
- "sharedFolder": "/Shared Data Extensions/DE - Germany",
1274
- "suffix": "_DE",
1275
- "countryCodeIn": "'DE'"
1276
- },
1277
- "PROD-NL": {
1278
- "mid": "12351",
1279
- "buName": "NL - Netherlands",
1280
- "sharedFolder": "/Shared Data Extensions/NL - Netherlands",
1281
- "suffix": "_NL",
1282
- "countryCodeIn": "'NL'"
1283
- }
1284
- }
1285
- ```
1286
-
1287
- Way more complex example with dedicated "Parent" BUs per environment (DEV, QA, PROD) and multiple country-specific BUs for QA and PROD:
1288
-
1289
- ```json
1290
- // example market config in your .mcdevrc.json
1291
- "markets": {
1292
- "DEV-Parent": {
1293
- "Account_Salesforce": "Account_Salesforce_1",
1294
- "suffix": "_DEV"
1295
- },
1296
- "DEV-NL": {
1297
- "mid": "12345",
1298
- "buName": "DEV - Child NL",
1299
- "sharedFolder": "Shared Items/Shared Data Extensions/DEV/NL",
1300
- "suffix": "_DEV_NL",
1301
- "countryCodeIn": "'NL'"
1302
- },
1303
- "QA-Parent": {
1304
- "Account_Salesforce": "Account_Salesforce_2",
1305
- "suffix": "_QA"
1306
- },
1307
- "QA-DE": {
1308
- "mid": "12346",
1309
- "buName": "QA - Child DE",
1310
- "sharedFolder": "Shared Items/Shared Data Extensions/QA/DE",
1311
- "suffix": "_QA_DE",
1312
- "countryCodeIn": "'DE'"
1313
- },
1314
- "QA-GULF": {
1315
- "mid": "12347",
1316
- "buName": "QA - Child GULF",
1317
- "sharedFolder": "Shared Items/Shared Data Extensions/QA/GULF",
1318
- "suffix": "_QA_GULF",
1319
- "countryCodeIn": "'AE', 'BH', 'IQ', 'KW', 'OM', 'QA', 'SA'"
1320
- },
1321
- "PROD-Parent": {
1322
- "Account_Salesforce": "Account_Salesforce",
1323
- "suffix": ""
1324
- },
1325
- "PROD-AT": {
1326
- "mid": "123458",
1327
- "buName": "AT - Austria",
1328
- "sharedFolder": "Shared Items/Shared Data Extensions/AT - Austria",
1329
- "suffix": "_AT",
1330
- "countryCodeIn": "'AT'"
1331
- },
1332
- "PROD-DE": {
1333
- "mid": "12349",
1334
- "buName": "DE - Germany",
1335
- "sharedFolder": "Shared Items/Shared Data Extensions/DE - Germany",
1336
- "suffix": "_DE",
1337
- "countryCodeIn": "'DE'"
1338
- },
1339
- "PROD-CH": {
1340
- "mid": "12352",
1341
- "buName": "CH - Switzerland",
1342
- "sharedFolder": "Shared Items/Shared Data Extensions/CH - Switzerland",
1343
- "suffix": "_CH",
1344
- "countryCodeIn": "'CH'"
1345
- },
1346
- "PROD-GULF": {
1347
- "mid": "12350",
1348
- "buName": "GULF - Arab states of the Persian Gulf",
1349
- "sharedFolder": "Shared Items/Shared Data Extensions/GULF - Arab states of the Persian Gulf",
1350
- "suffix": "_IC_GULF",
1351
- "countryCodeIn": "'AE', 'BH', 'IQ', 'KW', 'OM', 'QA', 'SA'"
1352
- },
1353
- "PROD-NL": {
1354
- "mid": "12351",
1355
- "buName": "NL - Netherlands",
1356
- "sharedFolder": "Shared Items/Shared Data Extensions/NL - Netherlands",
1357
- "suffix": "_NL",
1358
- "countryCodeIn": "'NL'"
1359
- }
1360
- }
1361
- ```
1362
-
1363
- <a name="market-list-configuration"></a>
1364
-
1365
- ### 7.4. Market List Configuration
1366
-
1367
- <a id="markdown-market-list-configuration" name="market-list-configuration"></a>
1368
-
1369
- Market Lists are very powerful and you will quickly notice how much time they can save you during your deployment preparation.
1370
- Let's first look at an example list config:
1371
-
1372
- ```json
1373
- // this is a market-list-config based on the example market-config listed above!
1374
- "markets": {...},
1375
- "marketList": {
1376
- "deployment-source": {
1377
- "description": "Define one 1:1 BU-Market combo here to as source for automated creation of deployment packages; you can create more than one source market list",
1378
- "MySandbox/DEV-NL": "DEV-NL"
1379
- },
1380
- "deployment-target": {
1381
- "description": "Define n BU-Market combo here to as target for automated creation of deployment packages; you can create more than one target market list and they can be as complex as you like",
1382
- "MySandbox/QA-DE": "QA-DE",
1383
- "MyProduction/PROD-DE": "PROD-DE",
1384
- "MyProduction/PROD-NL": "PROD-NL"
1385
- }
1386
- }
1387
- ```
1388
-
1389
- The above can be used together with `createDeltaPkg` command.
1390
-
1391
- Way more complex example:
1392
-
1393
- ```json
1394
- // this is a market-list-config based on the example market-config listed above!
1395
- "markets": {...},
1396
- "marketList": {
1397
- "Parent-shared": {
1398
- "description": "used to deploy shared data extensions",
1399
- "MySandbox/_ParentBU_": ["QA-DE", "QA-GULF"],
1400
- "MyProduction/_ParentBU_": ["PROD-AT", "PROD-CH", "PROD-DE", "PROD-GULF", "PROD-NL"]
1401
- },
1402
- "Parent-medium": {
1403
- "description": "if you use the instance's parent BU also for imports",
1404
- "MySandbox/_ParentBU_": "QA-Parent",
1405
- "MyProduction/_ParentBU_": "PROD-Parent"
1406
- },
1407
- "Parent-large": {
1408
- "description": "very large projects often decide against using the instance parent to get more order into the chaos and define their own 'parents' instead",
1409
- "MySandbox/QA-_Parent_": "QA-Parent",
1410
- "MyProduction/ProjectX-_Parent_": "PROD-Parent"
1411
- },
1412
- "Parent-medium-multi": {
1413
- "description": "equal to Parent-shared"
1414
- },
1415
- "Parent-large-multi": {
1416
- "description": "use to deploy market-adapted queries to your parent BUs",
1417
- "MySandbox/QA-_Parent_": ["QA-DE", "QA-GULF"],
1418
- "MyProduction/ProjectX-_Parent_": [
1419
- "PROD-AT",
1420
- "PROD-CH",
1421
- "PROD-DE",
1422
- "PROD-GULF",
1423
- "PROD-NL"
1424
- ]
1425
- },
1426
- "Children": {
1427
- "description": "use this to deploy to your market BUs",
1428
- "MySandbox/QA-DE": "QA-DE",
1429
- "MySandbox/QA-GULF": "QA-GULF",
1430
- "MyProduction/PROD-Child_AT": "PROD-AT",
1431
- "MyProduction/PROD-Child_CH": "PROD-CH",
1432
- "MyProduction/PROD-Child_DE": "PROD-DE",
1433
- "MyProduction/PROD-Child_GULF": "PROD-GULF",
1434
- "MyProduction/PROD-Child_NL": "PROD-NL"
1435
- }
1436
- }
1437
- ```
1438
-
1439
- First off, we don't see DEV in here. If you have more than one market in DEV then this might deviate but in general, you don't want to bulk-deploy to DEV as this is your single source of truth.
1440
- Apart from that, we can see 4 types of lists here:
1441
-
1442
- 1. `Parent-shared` (_instance parent_): This would be used to deploy the Shared Data Extensions to the instance parent. The child-configs are listed in an array to ensure we end up with one file per child in our parent BU folder.
1443
- 2. `Parent-medium`/`Parent-large` (medium:_instance parent_; large:_environment parent_): A 1:1 config that handles automations and the part of your solution that only runs on the parent.
1444
- 3. `Parent-medium-multi`/`Parent-large-multi` (medium:_instance parent_; large:_environment parent_): Any scripts, queries, automations that are executed on the parent but require one per child (e.g. query to fill country-specific Shared Data Extensions)
1445
- 4. `Children` (_child BUs_): everything that is needed on the market-specific Business Units.
1446
-
1447
- ## 8. Examples
1448
-
1449
- <a id="markdown-examples" name="examples"></a>
1450
-
1451
- ### 8.1. Retrieve and deploy Data Extension
1452
-
1453
- <a id="markdown-retrieve-and-deploy-data-extension" name="retrieve-and-deploy-data-extension"></a>
1454
-
1455
- 1. Retrieve metadata by running `mcdev retrieve <BU>` (where the BU corresponds to a credential-Business Unit combo in the **.mcdevrc.json**)
1456
- 2. Create a directory called `deploy/` in the root directory
1457
- 3. Create a directory called `dataExtension/` in the `deploy/` directory
1458
- 4. Copy a single dataExtension directory from the `retrieve/<credential>/<BU-Name>/dataExtension/` directory into `deploy/<credential>/<BU-Name>/dataExtension/`
1459
- 5. Run `mcdev deploy <BU>` to deploy everything in the **deploy** folder to the specified Business Unit
1460
-
1461
- ### 8.2. Metadata Retrieving/Backup
1462
-
1463
- <a id="markdown-metadata-retrieving%2Fbackup" name="metadata-retrieving%2Fbackup"></a>
1464
-
1465
- Metadata of a Business Unit can be retrieved by running the following command:
1466
-
1467
- `mcdev retrieve <BU>`
1468
-
1469
- where `<BU>` needs to be replaced with `credentialName/businessUnit-Name` that is defined in **.mcdevrc.json**.
1470
-
1471
- Run this command for each of your defined Business Units and this will result in a **retrieve** directory with a sub-directory for each Business Unit. Each sub-directory contains the metadata from this Business Unit that is currently supported to **retrieve**.
1472
-
1473
- This folder structure can be committed into a git repository and used as a backup.
1474
-
1475
- ### 8.3. Automation Deployment
1476
-
1477
- <a id="markdown-automation-deployment" name="automation-deployment"></a>
1478
-
1479
- Now we want to deploy an Automation with its related metadata. Select a retrieved Automation and copy it into the deploy folder. (`deploy/<credential>/<BU-Name>/automation/myAutomation.meta-automation.json`)
1480
-
1481
- Copy all related activity metadata of this automation into the deploy folder. (_Example:_ `deploy/<credential>/<BU-Name>/query/myquery.meta-query.json` and `deploy/<credential>/<BU-Name>/query/myquery.meta-query.sql`)
1482
-
1483
- To start the deployment run the following command:
1484
-
1485
- `mcdev deploy <BU>`
1486
-
1487
- ## 9. Contribute
1488
-
1489
- <a id="markdown-contribute" name="contribute"></a>
46
+ ## Contribute
1490
47
 
1491
48
  If you want to enhance Accenture SFMC DevTools you are welcome to fork the repo and create a pull request. Please understand that we will have to conduct a code review before accepting your changes.
1492
49
 
1493
- ### 9.1. Install Guide for Developers
1494
-
1495
- <a id="markdown-install-guide-for-developers" name="install-guide-for-developers"></a>
1496
-
1497
- Instead of installing Accenture SFMC DevTools as an npm dependency from our git repo, we recommend cloning our repo and then linking it locally:
1498
-
1499
- Assuming you cloned Accenture SFMC DevTools into `C:\repos\sfmc-devtools\` (or `~/repos/sfmc-devtools/` on Mac):
1500
-
1501
- 1. Open a terminal in your repo folder (`repos/sfmc-devtools/`)
1502
- 2. Execute `npm install` to download all the dependencies.
1503
- 3. Execute `npx husky install` to enable our git hooks.
1504
- 4. Execute `npm install -g "C:\repos\sfmc-devtools"` (this installs mcdev globally on your computer based on your cloned repo folder. Any changes you make in there will take immediate effect without the need for publishing or re-installing it).
1505
-
1506
- This should tell npm to create a symlink to your cloned local directory, allowing you to see updates you make in your mcdev repo instantly.
1507
-
1508
- To test your new **global** developer setup, run `mcdev --version` in CLI which should return the current version (e.g. `4.1.12`). Then, go into your mcdev repo and update the version with the suffix `-dev`, e.g. to `4.1.12-dev` and then run `mcdev --version` again to verify that your change propagates instantly.
1509
-
1510
- > **Not recommended:** Alternatively, you can install it locally only by opening a terminal in your project directory and executing `npm install --save-dev "C:\repos\sfmc-devtools"`
1511
- > To run the local version you need to prepend "npx" before your commands, e.g. `npx mcdev --version`
1512
-
1513
- **Note:** On MacOS you might need to prepend `sudo` to elevate your command.
1514
-
1515
- **Local vs. Global developer installation:**
1516
-
1517
- If you use Accenture SFMC DevTools in your team it is recommended to install your developer version **globally**, while the project's package.json should point to our Git repo in its devDependency section. Otherwise, other team members would have trouble due to potentially different paths.
1518
-
1519
- If you do need to install it locally, make sure you don't commit your project's package.json with this change or you might break mcdev for other developers in your team who either didn't clone the Accenture SFMC DevTools repo or stored it in a different directory.
1520
-
1521
- <a name="local-install"></a>
1522
-
1523
- ### 9.2. Local install
1524
-
1525
- <a id="markdown-local-install" name="local-install"></a>
1526
-
1527
- > **Warning:** local installation (leading to the use of [npx](https://github.com/npm/npx#readme)) causes issues when spaces are used in keys/names and is therefore not recommended.
1528
- > You will also make setting up projects much harder if you choose the local installation as you cannot use `mcdev init` to automatically setup your entire project.
1529
-
1530
- The following explains how you _could_ install it locally for certain edge cases:
1531
-
1532
- 1. Create a new folder for your upcoming SFMC project. Let's assume you named it `MyProject/`
1533
- > _Note:_ It is best practice to create a separate project folder for each of your client projects to avoid accidentally overwriting the wrong BU.
1534
- 2. Now, open a command line interface (CLI) for that folder.
1535
- - In Windows, you can easily do that by pressing SHIFT + Right-click into that folder and then selecting the option "Open PowerShell window here".
1536
- - Alternatively, you could use any other CLI. We recommend opting for [Visual Studio Code](https://code.visualstudio.com/download)'s "Terminal" as you can benefit from this later.
1537
- - Your CLI prompt should look something like `PS C:\repos\MyProject>` on Windows or `~/repos/MyProject/` on Mac.
1538
- 3. Initialize your new SFMC project by running `npm init`.
1539
- > _Note:_ npm is the "package manager" of Node.js and we use it to bundle Accenture SFMC DevTools together with other tools.
1540
- >
1541
- > If you are not familiar with node-projects or npm yet, we found this [blog post on nodesource.com](https://nodesource.com/blog/an-absolute-beginners-guide-to-using-npm/) to be helpful for beginners.
1542
- > In short, a package manager provides you with an easy name-based way of installing and updating tools you want to use as a team and ensuring that you are all using the same version.
1543
- 4. Afterwards, install Accenture SFMC DevTools by running `npm install --save-dev mcdev`
1544
- - If you get an error, please see the below troubleshooting section.
1545
-
1546
- When completed run `mcdev --version` and it will show you which version you installed (e.g. `4.1.12`).
1547
-
1548
- ### 9.3. NPM Scripts
50
+ More details on how to best do that are described in our [wiki](https://github.com/Accenture/sfmc-devtools/wiki/9.-Contribute).
1549
51
 
1550
- <a id="markdown-npm-scripts" name="npm-scripts"></a>
52
+ ## Main Contacts
1551
53
 
1552
- - `start`: Main entry point
1553
- - `mcdev`: alias for `start`
1554
- - `build`: Runs documentation and linting scripts
1555
- - `debug`: start debugging session
1556
- - `docs`: Generates jsdocs API documentation as markdown
1557
- - `lint`: Runs eslint with autofix and prettier
1558
- - `test`: Runs mocha tests - outdated
1559
- - `upgrade`: run npm-check to test for updated depdencies
54
+ The people that lead this project:
1560
55
 
1561
- ### 9.4. Developer Documentation
56
+ <table><tbody><tr><td align="center" valign="top" width="11%">
57
+ <a href="https://www.linkedin.com/in/joernberkefeld/">
58
+ <img src="https://github.com/JoernBerkefeld.png" width="250" height="250"><br />
59
+ <b>Jörn Berkefeld</b>
60
+ </a><br>
61
+ <a href="https://github.com/JoernBerkefeld">GitHub profile</a>
62
+ </td><td align="center" valign="top" width="11%">
63
+ <a href="https://www.linkedin.com/in/douglasmidgley/">
64
+ <img src="https://github.com/DougMidgley.png" width="250" height="250"><br />
65
+ <b>Doug Midgley</b>
66
+ </a><br>
67
+ <a href="https://github.com/DougMidgley">GitHub profile</a>
68
+ </td></tr></tbody></table>
1562
69
 
1563
- <a id="markdown-developer-documentation" name="developer-documentation"></a>
70
+ ## Copyright
1564
71
 
1565
- - [Link to API Documentation](docs/dist/documentation.md)
1566
- - [Link to Considerations & Findings Documentation](docs/dist/considerations.md)
72
+ Copyright (c) 2020-2022 Accenture. [MIT licensed](https://github.com/Accenture/sfmc-devtools/blob/main/LICENSE).