Releases: Accenture/sfmc-devtools
v7.6.3
Bugfixes
- #1877 ensure we don't lose event.schema information when creating new SF events by @JoernBerkefeld in #2007
Chores
- #1992 resolve fileNamePatternType in automations by @JoernBerkefeld in #1993
- #2005 resolve locationTypeId on fileLocation by @JoernBerkefeld in #2006
- #1990 improve error on filename and key mismatch by @JoernBerkefeld in #2008
Dependencies
- Bump @eslint/js from 9.17.0 to 9.18.0 by @dependabot in #2002
- Bump @types/node from 22.10.6 to 22.10.7 by @dependabot in #2003
- Bump eslint-config-prettier from 9.1.0 to 10.0.1 by @dependabot in #2004
- Bump eslint-plugin-jsdoc from 50.6.1 to 50.6.2 by @dependabot in #1997
- Bump eslint-plugin-prettier from 5.2.1 to 5.2.3 by @dependabot in #1996
- Bump fs-extra from 11.2.0 to 11.3.0 by @dependabot in #2001
- Bump lint-staged from 15.3.0 to 15.4.1 by @dependabot in #1998
- Bump yocto-spinner from 0.1.2 to 0.2.0 by @dependabot in #1999
Full Changelog: v7.6.2...v7.6.3
v7.6.2 - journey patches
Bugfixes
- #1859 ensure upserted dataExtract are saved with created and modified dates by @JoernBerkefeld in #1962
- #1857 ensure upserted sendClassification are saved with created and modified date by @JoernBerkefeld in #1963
- #1856 ensure upserted senderProfiles are saved with CreatedDate, ModifiedDate, createdBy and modifiedBy by @JoernBerkefeld in #1964
- #1796 ensure upserted events are saved with createdDate, createdBy, modifiedDate, modifiedBy by @JoernBerkefeld in #1966
- #1768 fix dataExtension Fields getting set to empty string after changeKeyField and dataExtension documentation not updated by @JoernBerkefeld in #1969
- #1790 allow re-deploying transactional journeys without transactionalEmail present as long as they are in Draft by @JoernBerkefeld in #1971
- #1972 calling
refresh
without defining a type results in unhandled error by @JoernBerkefeld in #1974 - #1771 auto-retrieving transactional journeys after publishing them failed to find transactionalEmails by @JoernBerkefeld in #1975
- #1803
deploy --publish
did not update local event jsons after success by @JoernBerkefeld in #1977 - #1902 update cc and bcc value on transactional journeys from transactionalEmail by @JoernBerkefeld in #1973
- #1943 refreshing transactional send journeys now changes the lastmodified timestamp on transactionalEmail and journey by @JoernBerkefeld in #1983
Chores
- #1960 hide prettier error log behind config option.formatErrorLog by @JoernBerkefeld in #1961
- #1967 remove folder info from sub-contentblocks in assets to avoid deployment blockers by @JoernBerkefeld in #1968
- #1923 support transactional send journeys for auto-refresh when publish is run on already published journeys by @JoernBerkefeld in #1970
- #1976 Guide VSCE users what to do when project and app version are out of sync by @JoernBerkefeld and @Dipasree-ghosh in #1987
- #1965 include vsce peacock in recommended extensions by @JoernBerkefeld in #1988
Dependencies
- Bump @types/node from 22.10.2 to 22.10.6 by @dependabot in #1979
- Bump c8 from 10.0.0 to 10.1.3 by @dependabot in #1950
- Bump dawidd6/action-download-artifact from 6 to 7 by @dependabot in #1906
- Bump eslint from 9.17.0 to 9.18.0 by @dependabot in #1980
- Bump fast-xml-parser from 4.4.1 to 4.5.1 by @dependabot in #1953
- Bump inquirer from 12.1.0 to 12.3.2 by @dependabot in #1986
- Bump ldez/gha-mjolnir from 1.4.1 to 1.5.0 by @dependabot in #1958
- Bump lint-staged from 15.2.10 to 15.3.0 by @dependabot in #1957
- Bump p-limit from 6.1.0 to 6.2.0 by @dependabot in #1951
- Bump typescript from 5.7.2 to 5.7.3 by @dependabot in #1978
- Bump yocto-spinner from 0.1.1 to 0.1.2 by @dependabot in #1952
Full Changelog: v7.6.1...v7.6.2
v7.6.1
Bugfixes
- #1942
refresh
triggeredsend fails with "no keys provided" error by @JoernBerkefeld and @PriyajitGhosh1995 in #1945
Chores
- #1940: resolve fileLocation in GCP triggered automations by @JoernBerkefeld in #1946
Full Changelog: v7.6.0...v7.6.1
v7.6.0
Features
- #1746 support
pause
andresume
for transactional send journeys by @JoernBerkefeld in #1765 - #1919 reroute
stop
journey topause
journey for transactional send journeys because these don't support stop by @JoernBerkefeld in #1920 - #1921 allow updating emails for selected journeys using the
refresh
command (transactional + multi-step) by @JoernBerkefeld in #1922 - #1879 Allow
stopping
all versions of a multi-step journey by @JoernBerkefeld in #1929
Bugfixes
- #1881 handle bad journey retrieve-by-key responses gracefully by @JoernBerkefeld in #1887
- #1774 show proper error when no keys were provided to
build / bt / bd / bdb
by @JoernBerkefeld in #1888 - #1889 throttle
refresh
to 10 concurrent triggeredSends/journeys to avoid timeouts; add icons for pause/publish/start by @JoernBerkefeld in #1890 - #1914 make dataExtension-not-found error easier to understand when trying to delete by @JoernBerkefeld in #1915
- #1916 keys with ":" in could not be found before by @JoernBerkefeld in #1917
- #1836 Ensure automatic new version creation during deploy only happens to multi-step jourmeys without a draft version - but not for transactional send journeys which are not versioned by @JoernBerkefeld in #1930
- #1837
deleting
transactional send journey no longer asks for a version by @JoernBerkefeld in #1931
Chores
- #1882 set maxKeyLength for journey and transactionalEmail by @JoernBerkefeld in #1883
- #1880 hint to using --ignoreSfFields / --isf to skip
deploy
error by @JoernBerkefeld in #1886
Dependencis
- Bump winston from 3.15.0 to 3.17.0 by @dependabot in #1871
- Bump @eslint/js from 9.10.0 to 9.15.0 by @dependabot in #1875
- Bump husky from 9.1.6 to 9.1.7 by @dependabot in #1872
- Bump chai from 5.1.1 to 5.1.2 by @dependabot in #1873
- Bump eslint from 9.10.0 to 9.15.0 and eslint-plugin-unicorn from 56.0.0 to 56.0.1 by @dependabot in #1874
- Bump eslint-plugin-jsdoc from 50.5.0 to 50.6.1 by @dependabot in #1937
- Bump @types/node from 22.9.0 to 22.10.2 by @dependabot in #1936
- Bump eslint from 9.15.0 to 9.17.0 by @dependabot in #1935
- Bump globals from 15.12.0 to 15.14.0 by @dependabot in #1938
- Bump @eslint/js from 9.15.0 to 9.17.0 by @dependabot in #1934
- Bump prettier from 3.3.3 to 3.4.2 by @dependabot in #1925
- Bump typescript from 5.6.3 to 5.7.2 by @dependabot in #1895
- Bump mocha from 10.7.3 to 11.0.1 by @dependabot in #1912
- Bump conf from 13.0.1 to 13.1.0 by @dependabot in #1926
Full Changelog: v7.5.0...v7.6.0
Details
Standard Commands
refresh
Command: mcdev refresh <business unit> [type] [external key] [--metadata]
Alias: mcdev re
This command lets you refresh emails in journeys and triggeredSends to ensure that updates made to the email or loaded content blocks get reflected when the emails are send out. This is only relevant is your journey is already "running" / your triggeredSend is "active".
If you do not specify keys, for triggeredSend, it will refresh all running ("Active") triggered sends on the given BU. It will also check if all dependencies for that triggered send are available to ensure it can be published & restarted after it was paused. However, if you made changes to the email that caused issues, you might still get an error, which prevents you from restarting it.
Currently supported types:
Name | CLI Argument | Effect |
---|---|---|
Triggered Send | triggeredSend |
Refreshes emails in active triggeredSends and, thereby, any emails in Journeys. |
Journey | journey |
Refreshes emails in multi-step journeys (by refreshing associated triggered sends) and transactional send journeys. |
Refreshing a multi-step journey will not be reflected in the journey's 'json. However, if you refresh a transactional send journey, it will affect the last modified date.
Example:
mcdev refresh MyProject/_ParentBU_ -m triggeredSend
mcdev refresh MyProject/_ParentBU_ -m triggeredSend:myTsKey
mcdev refresh MyProject/_ParentBU_ -m journey:key1 journey:key2
stop
Command: mcdev stop <business unit> [type] [key] [--like] [--metadata]
Alias: -
This command lets you stop metadata of a given type and key.
Currently supported types:
Name | CLI Argument | Effect |
---|---|---|
Journey | journey |
stops running journey |
For journeys
you can choose to specify a specific version to stop by appending "/4" (to stop version 4). If you do not append a version, mcdev will attempt to stop the latest version. Alternatively, you can stop all versions by appending "/*".
Example (stopping highest version):
mcdev stop MyProject/DEV -m journey:keyA journey:keyB journey:keyC
Example (stopping specific version):
mcdev stop MyProject/DEV -m journey:keyA/3 journey:keyB/2
Example (stopping all versions):
mcdev stop MyProject/DEV -m journey:keyC/*
stop with --like operator:
Instead of specifying a key, you can use the --like option to find your target. This is equal to not specifying a version and will default to the highest version.
mcdev stop MyProject/DEV -m journey --like.key "myprefix_%"
mcdev stop MyProject/DEV -m journey --like.key "myprefix_%" --like.r__folder_Path "my Journeys/Testing%"
stop on all BUs:
This variation of the stop command allows you to stop specified items on all BUs. mcdev will look for the items of defined types and keys on all BUs and stop them.
Example:
mcdev stop MyProject/* -m journey:keyA journey:keyB
mcdev stop MyProject/* -m journey:keyA/2 journey:keyB/3
mcdev stop MyProject/* -m journey:keyA/* journey:keyB/*
v7.5.0
Features
- #37 add support to
deploy
(update/create) automation wait activities by @JoernBerkefeld in #1829 - #1729 option to disable auto-formatting on save via config (
options.formatOnSave
) and--no-format
option for when you want or need to retain whatever manual formatting you applied. inspired by @AndrewEllis91, code by @JoernBerkefeld in #1846 - #1850 add method
validate journey
for multi-step journeys by @JoernBerkefeld in #1860 - #1851 add
--ignoreFolder
option todeploy --matchName
by @JoernBerkefeld in #1863 - #1852 add option
--ignoreSfFields
/--isf
to deploy, allowing you to skip false-positive errors about missing Salesforce fields for Salesforce-triggered journeys/events by @JoernBerkefeld in #1864 - #1294 include dataExtension retention policy in the created markdown file by @JoernBerkefeld in #1865
- #1825 add auto-renaming to avoid duplicate-name error for automation, query and senderProfile if
deployed
without--matchName
. This already existed for dataExtension and asset before. by @JoernBerkefeld in #1827
Bugfixes
- #1802
publishing
multiple non-Salesforce-triggered journeys looked messy by @JoernBerkefeld in #1817 - #1806 fix
createDeltaPackage
failing due to incorrect call tobuildTemplate
by @dnivara-0 and @JoernBerkefeld in #1821 - #1868 fix
createDeltaPackage
failing due to incorrect call tobuildDefinitionBulk
by @anasilva105 and @JoernBerkefeld in #1869 - #1826 fix importFile no longer deployable since last SFMC release by @JoernBerkefeld in #1828
- #1839 limit
noRootFolder validation rule
to types other than cloudpages by @JoernBerkefeld in #1843 - #1866 fix
buildTemplate
/buildDefintiion
/build
creating SSJS files with unwanted <script> tags by @PriyajitGhosh1995 & @JoernBerkefeld in #1867 - #1805 move purge-deploy-folder logic to handle multi-type templating with
build
by @JoernBerkefeld in #1820
Chores
- #1805
build
now asks if the BU's deploy folder should be emptied before runningbuildDefinition
, making it easier to run a clean deployment afterwards by @JoernBerkefeld in #1815 - #1814 filter journey builder triggeredSends from being saved to disk as all relevant info is also present in the journey itself by @JoernBerkefeld in #1816
- #1818 no longer include triggeredSend keys in templated journeys to ensure the resulting journey metadata shows most current info. Otherwise, journey builder will reference the latest triggeredSend but show the info from the first version of it instead. by @JoernBerkefeld in #1819
- #1808 set newly introduced iconUrl of events during
deploy
/retrieve
by @JoernBerkefeld in #1822 - #1800 improved error messages issues by
deploy
in general and bydeploy --matchName
errors by @JoernBerkefeld in #1823 - #1842 groundwork for supporting automation-triggered events by resolving the
automationid
in event by @JoernBerkefeld in #1845 - #1807 cross-check salesforce-triggered events with associated dataExtensions to ensure all required fields are present by @JoernBerkefeld in #1849
Dependencies
- Bump @types/node from 22.5.5 to 22.9.0 by @dependabot in #1862
- Bump axios-mock-adapter from 2.0.0 to 2.1.0 by @dependabot in #1789
- Bump eslint-plugin-jsdoc from 50.2.4 to 50.5.0 by @dependabot in #1773 & #1870
- Bump eslint-plugin-unicorn from 55.0.0 to 56.0.0 by @dependabot in #1777
- Bump globals from 15.9.0 to 15.12.0 by @dependabot in #1832
- Bump inquirer from 11.0.2 to 12.1.0 by @dependabot in #1861
- Bump mock-fs from 5.2.0 to 5.3.0 by @dependabot in #1756
- Bump simple-git from 3.25.0 to 3.27.0 by @dependabot in #1733
- Bump typescript from 5.6.2 to 5.6.3 by @dependabot in #1783
- Bump winston from 3.14.2 to 3.15.0 by @dependabot in #1775
- Bump yocto-spinner from 0.1.0 to 0.1.1 by @dependabot in #1786
Full Changelog: v7.4.4...v7.5.0
Details
Standard Commands
retrieve
Command: mcdev retrieve [business unit] [metadata type] [metadata key] [--like] [--metadata] [--format] [--no-format]
...
retrieve with --format or --no-format option:
If you need to retrieve code in a raw format, you may use mcdev retrieve --no-format
to disable auto-formatting. On the other hand, if options.formatOnSave
is set to false, then mcdev retrieve --format
enables formatting.
deploy
Command: mcdev deploy [business unit] [metadata type] [metadata key] [--metadata] [--fromRetrieve] [--refresh] [--keySuffix] [--noMidSuffix] [--changeKeyValue=yourNewKey] [--changeKeyField=otherFieldInJson] [--execute] [--schedule] [--fixShared] [--noUpdate] [--publish] [--skipStatusCheck] [--matchName] [--ignoreFolder] [--skipValidation] [--format] [--no-format] [--ignoreSfFields]
...
deploy with --format or --no-format option:
After deploying, the deployed item is saved in the respective retrieve folder. If you need to retrieve code in a raw format, you may use mcdev deploy --no-format
to disable auto-formatting. On the other hand, if options.formatOnSave
is set to false, then mcdev deploy --format
enables formatting.
deploy with --matchName (and --ignoreFolder):
...
If running --matchName returns many single matches but the found items reside in a different folder, using --ignoreFolder lets you still override these items automatically, easing your cleanup job. So far, this is supported for dataExtensions only.
deploy with --ignoreSfFields:
When deploying Salesforce-triggered journeys you might encounter false positives regarding missing fields for a Salesforce object. In these cases, the option --ignoreSfFields allows you to reduce the error to a warning and deploy it.
validate
Command: mcdev validate <business unit> [metadata type] [metadata key] [--like] [--metadata]
Alias: n/a
Currently supported types:
Name | CLI Argument | Effect |
---|---|---|
Journey | journey |
Validates a Draft-version of a journey |
You can validate a draft journey using this command, without having to actually publish it. This is the same as clicking on the Validate-button in the web interface.
mcdev validate cred/bu journey myJourneyKey
mcdev validate cred/bu journey id:myJourneyId
mcdev validate cred/bu -m journey:myJourneyKey -m journey:id:myJourneyId
Advanced Configuration
Config Options
Setting | Default | Description |
---|---|---|
options.formatOnSave | true | Allows disabling auto-formatting for all retrieve/deploy operations |
v7.4.4
Bugfixes
- #1761 fix validation rules for deploy and ensure they work on a clone by @JoernBerkefeld in #1762
- #1763 correctly cache transactionalEmail during journey deployment by @JoernBerkefeld in #1764
Chores
- #1748 resolve send classification in transactionalemail by @JoernBerkefeld in #1755
- #1749 update journey with data from transactionalEmail by @JoernBerkefeld in #1760
- #1754 add new validation rule to warn about ampscript getting wrapped in script tags by @JoernBerkefeld in #1766
Full Changelog: v7.4.3...v7.4.4
v7.4.3
Bugfixes
- #1738 stop if all publish actions failed and do not re-retrieve
journey
&transactionalEmails
by @JoernBerkefeld in #1739 - #1740 fix javascript error for ccEmail by adding missing preDeployment handling for
journey
activities by @JoernBerkefeld in #1741 - #1742 correctly retrieve all related
transactionalEmails
after publishing a transactional sendjourney
instead of just the first one by @JoernBerkefeld in #1744 - #1323 ensure newly mcdev-created
senderProfiles
are selectable in journey message configuration by @JoernBerkefeld in #1745
Chores
- #1730 resolve
deliveryProfile
injourneys
by @JoernBerkefeld in #1731 - #1708 resolve createdby and modifiedby user ids on
dataExtract
,event
,senderProfile
andverification
by @JoernBerkefeld in #1737 - #1726 improve linting for .mcdev-validations.js by @JoernBerkefeld in #1727
- #1750 improve debug logging for .mcdev-validations.js by @JoernBerkefeld in #1751
Full Changelog: v7.4.2...v7.4.3
v7.4.2
Bugfixes
- #1717
--skipValidation
does not work for retrieve by @JoernBerkefeld in #1718 - #126
folders
saved to retrieve during deploy even if not listed for retrieval by @JoernBerkefeld in #1720
Chores
- #1716 update
journey
-triggeredSendStatus and suppressTracking by @JoernBerkefeld and @SanskarVaidya in #1719 - #1721 disable auto-opening markdown renderer to enable VSCode's diff viewer for git by @JoernBerkefeld in #1722
Dependencies
- Bump @types/node from 22.5.4 to 22.5.5 by @dependabot in #1711
- Bump @types/mocha from 10.0.7 to 10.0.8 by @dependabot in #1714
- Bump husky from 9.1.5 to 9.1.6 by @dependabot in #1712
- Bump inquirer from 10.2.2 to 11.0.2 by @dependabot in #1724
- Bump eslint-plugin-jsdoc from 50.2.2 to 50.2.4 by @dependabot in #1723
Full Changelog: v7.4.1...v7.4.2
v7.4.1
Bugfixes
- #1676 graceful handling of "key not found" error for
journey
andevent
by @JoernBerkefeld in #1677 - #1177 make
dataExtension
-field add/update check case insensitive and remove redundant caching by @JoernBerkefeld in #1694 - #1690 show info how to fix mcdev-config issues in VSCE logs by @JoernBerkefeld and @Dipasree-ghosh in #1696
- #1692 don't flag common-vs-contact issue on currently running (active/published)
journeys
andevents
by @JoernBerkefeld and @Dipasree-ghosh in #1698 - #1545 fix "Upserting folder failed"-error by cleaning up the auto-created
folder
-directory before each deployment by @JoernBerkefeld in #1701
Chores
- #1679 gitignore .BAK files in project folders. These get created by mcdev upgrade. by @JoernBerkefeld in #1691
- #1695 properly warn about potentially missing SF object access and how to fix it in
journey
andevent
by @JoernBerkefeld in #1697 - #1680 list CC and BCC values on
journey
email activities as arrays and remove them fromtriggeredSend
(because those fields were always returned empty by the API) by @JoernBerkefeld in #1699 - #1674 ensure
journey
activities and entry-event
fields are sorted alphabetically to ease pull request reviews by @JoernBerkefeld in #1700
Dependencies
- Bump @eslint/js from 9.9.0 to 9.10.0 by @dependabot in #1684
- Bump @types/node from 22.4.2 to 22.5.4 by @dependabot in #1686
- Bump eslint from 9.9.0 to 9.10.0 by @dependabot in #1687
- Bump inquirer from 10.1.8 to 10.2.2 by @dependabot in #1683
- Bump lint-staged from 15.2.9 to 15.2.10 by @dependabot in #1655
- Bump typescript from 5.5.4 to 5.6.2 by @dependabot in #1688
- Bump update-notifier from 7.2.0 to 7.3.1 by @dependabot in #1682
Special Thanks
Thank you to community member @Dipasree-ghosh for supporting the research around how common-fields are used in Salesforce-triggered journeys (#1692) and for pointing out an issue regarding missing hints for how to fix config issues when the command was run via VSCode extension (#1690).
Full Changelog: v7.4.0...v7.4.1
v7.4.0 - Validation rules
Features
- #1643 validation rules for retrieve, buildDefinition and deploy by @JoernBerkefeld in #1648
- #1645 option to define custom validation rules for retrieve, buildDefinition and deploy by @JoernBerkefeld in #1649
- #1666 optional validation rule overrides per types via .mcdevrc config by @JoernBerkefeld in #1667
- #1671 add option to reduce validation rule errors to warnings via option
--skipValidation
for deploy, build, buildDefinition, buildDefinitionBulk by @JoernBerkefeld in #1672 - #1434 add
resume journey
viaexecute
-method (including adding an aliasresume
for that command) by @JoernBerkefeld in #1630 - #1651: allow using
--matchName
withdeploy dataExtension
(this previously only worked withasset
) by @JoernBerkefeld in #1656
Bugfixes
- #1505 fix incorrect asset links in
journeys
when retrieved together withtriggeredSends
by @JoernBerkefeld in #1640 - #1472 fix dependency-not-found deploy-error by adapting order in which
assets
are deployed, solving the inter-type dependencies by @JoernBerkefeld in #1502 - #1646 fix config files not actually getting updated during mcdev upgrade when it was presented as optional by @JoernBerkefeld in #1647
- #1644 automatic workaround, not solution for the "string or binary data would be truncated"-error by @JoernBerkefeld in #1660
- #1657 fix
journey
/event
eventDataSummary not getting saved correctly by @JoernBerkefeld in #1658 - #1668 sf object checks for
events
andjourneys
fail if multiple entries are retrieved-by-key due to race conditions by @JoernBerkefeld in #1669
Chores
- #1637 enable syntax highlighting for SSJS files in GitLab by @JoernBerkefeld in #1638
Full Changelog: v7.3.1...v7.4.0
Details
Standard Commands
deploy
Command: mcdev deploy [business unit] [metadata type] [metadata key] [--metadata] [--fromRetrieve] [--refresh] [--keySuffix] [--noMidSuffix] [--changeKeyValue=yourNewKey] [--changeKeyField=otherFieldInJson] [--execute] [--schedule] [--fixShared] [--noUpdate] [--publish] [--skipStatusCheck] [--matchName] [--skipValidation]
New option --skipValidation
deploy with --matchName:
Currently supported types:
Name | CLI Argument |
---|---|
Asset | asset |
Data Extension | dataExtension |
deploy --matchName
now supports dataExtensions
execute
Command: mcdev execute <business unit> [type] [key] [--like] [--schedule] [--metadata]
Alias: mcdev exec
/ mcdev start
/ mcdev resume
Currently supported types:
Name | CLI Argument | Effect |
---|---|---|
Automation | automation |
RunOnce or Schedules automation according to already existing schedule |
Query | query |
Starts query execution |
Journey | journey |
Resumes a paused journey |
Now supports
journey
publish
Command: mcdev publish <business unit> [metadata type] [metadata key] [--like] [--skipStatusCheck] [--metadata]
Alias: mcdev activate
Currently supported types:
Name | CLI Argument | Effect |
---|---|---|
Journey | journey |
Activates a Draft-version of a journey (creates related transactionalEmail or event record) |
New alias
activate
to mimic the lingo in Journey Builder
Templating Commands
build
Command: mcdev build <--buFrom> <--marketFrom> <--buTo> <--marketTo> <--metadata> [--bulk] [--dependencies] [--retrieve] [--skipValidation]
New option --skipValidation
buildDefinition
Command: mcdev buildDefinition <business unit> [type] [template name] [market] [--metadata] [--market] [--skipValidation]
New option --skipValidation
buildDefinitionBulk
Command: mcdev buildDefinitionBulk <market list name> <type> <template name> [--metadata] [--skipValidation]
New option --skipValidation
Advanced Configuration
.mcdevrc.json
The central config in .mcdevrc.json
holds multiple adjustable settings:
{
"options": {
"validation": {
"retrieve": {
"noGuidKeys": "warn",
"noRootFolder": "warn",
"overrides": [
{
"type": [
"journey"
],
"options": {
"noGuidKeys": "off",
}
}
]
},
"buildDefinition": {
"noGuidKeys": "warn",
"noRootFolder": "warn",
"overrides": [
{
"type": [
"journey"
],
"options": {
"noGuidKeys": "off",
}
}
]
},
"deploy": {
"noGuidKeys": "error",
"noRootFolder": "error",
"overrides": [
{
"type": [
"journey"
],
"options": {
"noGuidKeys": "off",
}
}
]
}
},
},
}
Setting | Default | Description |
---|---|---|
options.validation | current default and custom rules | Allows setting validation rules to "off", "warn" or "error |
Validation rules
You can define validation rules for retrieve
, buildDefinition
and deploy
.
The following rules exist out of the box:
- noGuidKeys: test for metadata that has a GUID / UUID as key.
- noRootFolder: test if metadata that does exist in a folder resides in the root for that particular type or in a subfolder.
Possible rule settings are:
- not set, which implicitly turns off the rule
- "off" explicitly turns off the rule
- "warn" shows a log message of type warning
- "error" shows a log message of type error AND blocks further execution
- for
retrieve
that prevents download - for
buildDefintion
(andbuild
) that prevents the creation of the corresponding file in the deploy folder - for
deploy
this will prevent deployment.
- for
Please keep in mind that you can always skip validation rules all together at run-time by adding --skipValidation to your command (deploy / build / buildDefinition / buildDefinitionBulk)
Custom Validation rules - .mcdev-validation.js
Optionally one can create a file named .mcdev-validations.js
in the root of your project to specify your own validation rules. That gives you full flexibility to test for whatever guidelines you might have as you can literally parse the JSON of the metadata yourself.
One example that depends on BU names and hence is not part of the standard set could look like this:
'use strict';
const buSuffixMap = {
_ParentBU_: '',
DEV: '_DEV',
QA: '_QA',
PROD: '',
};
/**
*
* @param {any} definition type defintiion
* @param {any} item metadata json
* @param {string} targetDir where the metadata is stored ("deploy/cred/bu")
* @param {any} Util helper methods
* @returns {Promise.<any>} validation rule
*/
export function validation(definition, item, targetDir, Util) {
const bu = targetDir.includes('/') ? targetDir.split('/').pop() : targetDir.split('\\').pop();
const suffix = buSuffixMap[bu];
if (suffix === undefined) {
Util.logger.error(
`BU '${bu}' not defined for keySuffix validation in .mcdev-validations.js`
);
}
return {
keySuffix: {
failedMsg: 'Key Suffix expected but not found: ' + suffix,
/**
* @returns {boolean} true=test passed
*/
passed: function () {
// exclude non-relevant items
const relevantTypes = ['asset', 'dataExtension'];
if (!relevantTypes.includes(definition.type)) {
return true;
}
if (
definition.type === 'dataExtension' &&
item.r__folder_ContentType !== 'shared_dataextension'
) {
// only shared DEs need a suffix
return true;
}
// actual test
const key = item[definition.keyField] + '';
if (key) {
return key.endsWith(suffix);
} else {
Util.logger.debug('validation-keySuffix: key not found');
return true;
}
},
},
};
}
To control how a custom rule is applied, simply add its name (in the above example, keySuffix
) to options.validation like you would for the default rules. Because custom rules are configured in the same way as default rules, you can also use the same override logic for them
"validation": {
"retrieve": {
"keySuffix": "warn",
"noGuidKeys": "warn",
"noRootFolder": "warn",
},
"buildDefinition": {
"keySuffix": "warn",
"noGuidKeys": "warn",
"no...