@salesforce/plugin-custom-metadata 2.0.9 → 2.0.12
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.
- package/README.md +0 -1
- package/lib/commands/generate/cmdt/field.d.ts +23 -0
- package/lib/commands/generate/cmdt/field.js +100 -0
- package/lib/commands/generate/cmdt/field.js.map +1 -0
- package/lib/commands/generate/cmdt/fromorg.d.ts +26 -0
- package/lib/commands/generate/cmdt/fromorg.js +184 -0
- package/lib/commands/generate/cmdt/fromorg.js.map +1 -0
- package/lib/commands/generate/cmdt/object.d.ts +23 -0
- package/lib/commands/generate/cmdt/object.js +79 -0
- package/lib/commands/generate/cmdt/object.js.map +1 -0
- package/lib/commands/generate/cmdt/record.d.ts +29 -0
- package/lib/commands/generate/cmdt/record.js +111 -0
- package/lib/commands/generate/cmdt/record.js.map +1 -0
- package/lib/commands/generate/cmdt/records.d.ts +18 -0
- package/lib/commands/generate/cmdt/records.js +105 -0
- package/lib/commands/generate/cmdt/records.js.map +1 -0
- package/lib/shared/helpers/createUtil.d.ts +51 -0
- package/lib/shared/helpers/createUtil.js +168 -0
- package/lib/shared/helpers/createUtil.js.map +1 -0
- package/lib/shared/helpers/fileWriter.d.ts +24 -0
- package/lib/shared/helpers/fileWriter.js +59 -0
- package/lib/shared/helpers/fileWriter.js.map +1 -0
- package/lib/{lib → shared}/helpers/metadataUtil.d.ts +1 -1
- package/lib/{lib → shared}/helpers/metadataUtil.js +1 -1
- package/lib/shared/helpers/metadataUtil.js.map +1 -0
- package/lib/{lib → shared}/helpers/validationUtil.d.ts +0 -0
- package/lib/{lib → shared}/helpers/validationUtil.js +0 -0
- package/lib/shared/helpers/validationUtil.js.map +1 -0
- package/lib/{lib → shared}/interfaces/createConfig.d.ts +3 -2
- package/lib/{lib → shared}/interfaces/createConfig.js +0 -0
- package/lib/shared/interfaces/createConfig.js.map +1 -0
- package/lib/shared/templates/templates.d.ts +20 -0
- package/lib/shared/templates/templates.js +208 -0
- package/lib/shared/templates/templates.js.map +1 -0
- package/messages/field.md +79 -0
- package/messages/fromorg.md +87 -0
- package/messages/object.md +73 -0
- package/messages/record.md +53 -0
- package/messages/records.md +49 -0
- package/messages/template.md +3 -0
- package/messages/validation.md +11 -0
- package/oclif.manifest.json +1 -1
- package/package.json +20 -22
- package/schemas/generate-cmdt-fromorg.json +19 -0
- package/schemas/generate-cmdt-record.json +378 -0
- package/schemas/generate-cmdt-records.json +406 -0
- package/lib/commands/force/cmdt/create.d.ts +0 -25
- package/lib/commands/force/cmdt/create.js +0 -94
- package/lib/commands/force/cmdt/create.js.map +0 -1
- package/lib/commands/force/cmdt/field/create.d.ts +0 -25
- package/lib/commands/force/cmdt/field/create.js +0 -113
- package/lib/commands/force/cmdt/field/create.js.map +0 -1
- package/lib/commands/force/cmdt/generate.d.ts +0 -27
- package/lib/commands/force/cmdt/generate.js +0 -219
- package/lib/commands/force/cmdt/generate.js.map +0 -1
- package/lib/commands/force/cmdt/record/create.d.ts +0 -32
- package/lib/commands/force/cmdt/record/create.js +0 -140
- package/lib/commands/force/cmdt/record/create.js.map +0 -1
- package/lib/commands/force/cmdt/record/insert.d.ts +0 -16
- package/lib/commands/force/cmdt/record/insert.js +0 -110
- package/lib/commands/force/cmdt/record/insert.js.map +0 -1
- package/lib/lib/helpers/createUtil.d.ts +0 -62
- package/lib/lib/helpers/createUtil.js +0 -170
- package/lib/lib/helpers/createUtil.js.map +0 -1
- package/lib/lib/helpers/fileWriter.d.ts +0 -27
- package/lib/lib/helpers/fileWriter.js +0 -63
- package/lib/lib/helpers/fileWriter.js.map +0 -1
- package/lib/lib/helpers/metadataUtil.js.map +0 -1
- package/lib/lib/helpers/validationUtil.js.map +0 -1
- package/lib/lib/interfaces/createConfig.js.map +0 -1
- package/lib/lib/templates/templates.d.ts +0 -37
- package/lib/lib/templates/templates.js +0 -221
- package/lib/lib/templates/templates.js.map +0 -1
- package/messages/createField.json +0 -24
- package/messages/createRecord.json +0 -32
- package/messages/createType.json +0 -33
- package/messages/generate.json +0 -40
- package/messages/insertRecord.json +0 -26
- package/messages/template.json +0 -3
- package/messages/validation.json +0 -5
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2020, salesforce.com, inc.
|
|
4
|
+
* All rights reserved.
|
|
5
|
+
* Licensed under the BSD 3-Clause license.
|
|
6
|
+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.canConvert = exports.createDefaultTypeStructure = exports.createFieldXML = exports.createObjectXML = void 0;
|
|
10
|
+
/* eslint-disable class-methods-use-this */
|
|
11
|
+
const core_1 = require("@salesforce/core");
|
|
12
|
+
core_1.Messages.importMessagesDirectory(__dirname);
|
|
13
|
+
const messages = core_1.Messages.load('@salesforce/plugin-custom-metadata', 'template', ['errorNotAValidType']);
|
|
14
|
+
/**
|
|
15
|
+
* Using the given data and visibility, creates the body of a type metadata file
|
|
16
|
+
*
|
|
17
|
+
* @param data
|
|
18
|
+
* @param visibility
|
|
19
|
+
*/
|
|
20
|
+
const createObjectXML = ({ label, pluralLabel }, visibility) => {
|
|
21
|
+
let returnValue = '<?xml version="1.0" encoding="UTF-8"?>\n';
|
|
22
|
+
returnValue += '<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">\n';
|
|
23
|
+
returnValue += `\t<label>${label}</label>\n`;
|
|
24
|
+
returnValue += `\t<pluralLabel>${pluralLabel}</pluralLabel>\n`;
|
|
25
|
+
returnValue += `\t<visibility>${visibility}</visibility>\n`;
|
|
26
|
+
returnValue += '</CustomObject>\n';
|
|
27
|
+
return returnValue;
|
|
28
|
+
};
|
|
29
|
+
exports.createObjectXML = createObjectXML;
|
|
30
|
+
/**
|
|
31
|
+
* Using the given data and defaultToString, creates the body for a field file.
|
|
32
|
+
*
|
|
33
|
+
* @param data Record details
|
|
34
|
+
* @param defaultToString If the defaultToString set type to Text for unsupported field types
|
|
35
|
+
*/
|
|
36
|
+
const createFieldXML = (data, defaultToString) => {
|
|
37
|
+
let returnValue = '<?xml version="1.0" encoding="UTF-8"?>\n';
|
|
38
|
+
returnValue += '<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">\n';
|
|
39
|
+
returnValue += getFullName(data);
|
|
40
|
+
returnValue += getDescription(data);
|
|
41
|
+
returnValue += getExternalId(data);
|
|
42
|
+
returnValue += getFieldManageability(data);
|
|
43
|
+
returnValue += getInlineHelpText(data);
|
|
44
|
+
returnValue += getLabel(data);
|
|
45
|
+
returnValue += getType(data, defaultToString);
|
|
46
|
+
returnValue += getDefaultValue(data);
|
|
47
|
+
returnValue += getRequiredTag(data);
|
|
48
|
+
returnValue += getLengthTag(data);
|
|
49
|
+
returnValue += getVisibleLines(data);
|
|
50
|
+
// preventing standard objects that have fields that are being convered from passing in data
|
|
51
|
+
// that is no longer relevant
|
|
52
|
+
// e.g. multiselectpicklist are being converted to long text area and long text area's do not support valuesets
|
|
53
|
+
if ((0, exports.canConvert)(data.type)) {
|
|
54
|
+
returnValue += getValueSet(data);
|
|
55
|
+
returnValue += getPrecisionTag(data);
|
|
56
|
+
returnValue += getScaleTag(data);
|
|
57
|
+
}
|
|
58
|
+
returnValue += '</CustomField>\n';
|
|
59
|
+
return returnValue;
|
|
60
|
+
};
|
|
61
|
+
exports.createFieldXML = createFieldXML;
|
|
62
|
+
const createDefaultTypeStructure = (fullName, type, label, picklistValues = [], decimalplaces = 0) => {
|
|
63
|
+
const precision = 18 - decimalplaces;
|
|
64
|
+
const scale = decimalplaces;
|
|
65
|
+
const baseObject = { fullName, type, label, summaryFilterItems: [] };
|
|
66
|
+
switch (type) {
|
|
67
|
+
case 'Checkbox':
|
|
68
|
+
return { ...baseObject, defaultValue: 'false' };
|
|
69
|
+
case 'Email':
|
|
70
|
+
return { ...baseObject, unique: false };
|
|
71
|
+
case 'Number':
|
|
72
|
+
return { ...baseObject, precision, scale, unique: false };
|
|
73
|
+
case 'Percent':
|
|
74
|
+
return { ...baseObject, precision, scale };
|
|
75
|
+
case 'Picklist':
|
|
76
|
+
return {
|
|
77
|
+
...baseObject,
|
|
78
|
+
valueSet: {
|
|
79
|
+
restricted: true,
|
|
80
|
+
valueSetDefinition: {
|
|
81
|
+
sorted: false,
|
|
82
|
+
value: createPicklistValues(picklistValues),
|
|
83
|
+
},
|
|
84
|
+
valueSettings: [],
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
case 'Text':
|
|
88
|
+
return { ...baseObject, unique: false, length: 100 };
|
|
89
|
+
case 'LongTextArea':
|
|
90
|
+
return { ...baseObject, length: 32768, visibleLines: 3 };
|
|
91
|
+
case 'Date':
|
|
92
|
+
case 'DateTime':
|
|
93
|
+
case 'Phone':
|
|
94
|
+
case 'TextArea':
|
|
95
|
+
case 'Url':
|
|
96
|
+
return baseObject;
|
|
97
|
+
default:
|
|
98
|
+
return baseObject;
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
exports.createDefaultTypeStructure = createDefaultTypeStructure;
|
|
102
|
+
const canConvert = (type) => {
|
|
103
|
+
const metadataFieldTypes = [
|
|
104
|
+
'Checkbox',
|
|
105
|
+
'Date',
|
|
106
|
+
'DateTime',
|
|
107
|
+
'Email',
|
|
108
|
+
'Number',
|
|
109
|
+
'Percent',
|
|
110
|
+
'Phone',
|
|
111
|
+
'Picklist',
|
|
112
|
+
'Text',
|
|
113
|
+
'TextArea',
|
|
114
|
+
'LongTextArea',
|
|
115
|
+
'Url',
|
|
116
|
+
];
|
|
117
|
+
return typeof type === 'string' && metadataFieldTypes.includes(type);
|
|
118
|
+
};
|
|
119
|
+
exports.canConvert = canConvert;
|
|
120
|
+
const createPicklistValues = (values) => values.map((value) => ({ fullName: value, label: value, default: false }));
|
|
121
|
+
const getType = (data, defaultToMetadataType) => {
|
|
122
|
+
if ((0, exports.canConvert)(data.type)) {
|
|
123
|
+
// To handle the text formula field scenario where field type will be Text with no length attribute
|
|
124
|
+
if (data.type === 'Text' && data.length === undefined) {
|
|
125
|
+
return '\t<type>LongTextArea</type>\n';
|
|
126
|
+
}
|
|
127
|
+
return `\t<type>${data.type}</type>\n`;
|
|
128
|
+
}
|
|
129
|
+
else if (defaultToMetadataType) {
|
|
130
|
+
return `\t<type>${getConvertType(data)}</type>\n`;
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
throw new core_1.SfError(messages.getMessage('errorNotAValidType', [data.type]));
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
const getLengthTag = (data) => {
|
|
137
|
+
// If field type is multiselect or
|
|
138
|
+
// data type is text with no length attribute then it is formula field then set the length to 32768 as we are setting the type LongTextArea
|
|
139
|
+
if (data.type === 'MultiselectPicklist' || (data.type === 'Text' && data.length === undefined)) {
|
|
140
|
+
return '\t<length>32768</length>\n';
|
|
141
|
+
}
|
|
142
|
+
if (data.length) {
|
|
143
|
+
return `\t<length>${data.length}</length>\n`;
|
|
144
|
+
}
|
|
145
|
+
// For fields that are being translated from Custom objects that do not have a matching type they are
|
|
146
|
+
// being defaulted to a Text field. They need to have a minimum length to them
|
|
147
|
+
// e.g. Field types that are getting converted: Currency, Location, MasterDetail, Lookup
|
|
148
|
+
return !(0, exports.canConvert)(data.type) && getConvertType(data) === 'Text' ? '\t<length>100</length>\n' : '';
|
|
149
|
+
};
|
|
150
|
+
const getVisibleLines = (data) => {
|
|
151
|
+
if (data.type === 'Text' && data.length === undefined) {
|
|
152
|
+
return '\t<visibleLines>3</visibleLines>\n';
|
|
153
|
+
}
|
|
154
|
+
return data.visibleLines ? `\t<visibleLines>${data.visibleLines}</visibleLines>\n` : '';
|
|
155
|
+
};
|
|
156
|
+
const getDefaultValue = (data) => {
|
|
157
|
+
if (data.type === 'Currency') {
|
|
158
|
+
return data.defaultValue ? `\t<defaultValue>'${data.defaultValue}'</defaultValue>\n` : '';
|
|
159
|
+
}
|
|
160
|
+
else if (data.type === 'Checkbox' && data.defaultValue === undefined) {
|
|
161
|
+
return '\t<defaultValue>false</defaultValue>\n';
|
|
162
|
+
}
|
|
163
|
+
return data.defaultValue ? `\t<defaultValue>${data.defaultValue}</defaultValue>\n` : '';
|
|
164
|
+
};
|
|
165
|
+
const getValueSet = (data) => {
|
|
166
|
+
var _a, _b, _c, _d;
|
|
167
|
+
let fieldValue = '';
|
|
168
|
+
if (data.valueSet) {
|
|
169
|
+
fieldValue += '\t<valueSet>\n';
|
|
170
|
+
fieldValue += `\t\t<restricted>${(_a = data.valueSet.restricted) !== null && _a !== void 0 ? _a : false}</restricted>\n`;
|
|
171
|
+
fieldValue += '\t\t<valueSetDefinition>\n';
|
|
172
|
+
fieldValue += `\t\t\t<sorted>${(_c = (_b = data.valueSet.valueSetDefinition) === null || _b === void 0 ? void 0 : _b.sorted) !== null && _c !== void 0 ? _c : false}</sorted>\n`;
|
|
173
|
+
(_d = data.valueSet.valueSetDefinition) === null || _d === void 0 ? void 0 : _d.value.forEach((value) => {
|
|
174
|
+
fieldValue += '\t\t\t<value>\n';
|
|
175
|
+
fieldValue += `\t\t\t\t<fullName>${value.fullName}</fullName>\n`;
|
|
176
|
+
fieldValue += `\t\t\t\t<default>${value.default || false}</default>\n`;
|
|
177
|
+
fieldValue += `\t\t\t\t<label>${value.label}</label>\n`;
|
|
178
|
+
fieldValue += '\t\t\t</value>\n';
|
|
179
|
+
});
|
|
180
|
+
fieldValue += '\t\t</valueSetDefinition>\n';
|
|
181
|
+
fieldValue += '\t</valueSet>\n';
|
|
182
|
+
}
|
|
183
|
+
return fieldValue;
|
|
184
|
+
};
|
|
185
|
+
const getConvertType = (data) => {
|
|
186
|
+
if (data.type === 'Html' ||
|
|
187
|
+
data.type === 'MultiselectPicklist' ||
|
|
188
|
+
(data.type === 'Text' && data.length === undefined)) {
|
|
189
|
+
return 'LongTextArea';
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
return 'Text';
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
const getFullName = (data) => {
|
|
196
|
+
var _a;
|
|
197
|
+
const name = ((_a = data.fullName) === null || _a === void 0 ? void 0 : _a.endsWith('__c')) ? data.fullName : `${data.fullName}__c`;
|
|
198
|
+
return `\t<fullName>${name}</fullName>\n`;
|
|
199
|
+
};
|
|
200
|
+
const getDescription = (data) => data.description ? `\t<description>${data.description}</description>\n` : '';
|
|
201
|
+
const getExternalId = (data) => data.externalId ? `\t<externalId>${data.externalId}</externalId>\n` : '';
|
|
202
|
+
const getFieldManageability = (data) => { var _a; return `\t<fieldManageability>${(_a = data.fieldManageability) !== null && _a !== void 0 ? _a : 'DeveloperControlled'}</fieldManageability>\n`; };
|
|
203
|
+
const getInlineHelpText = (data) => data.inlineHelpText ? `\t<inlineHelpText>${data.inlineHelpText}</inlineHelpText>\n` : '';
|
|
204
|
+
const getLabel = (data) => `\t<label>${data.label}</label>\n`;
|
|
205
|
+
const getRequiredTag = (data) => typeof data.unique === 'boolean' ? `\t<unique>${data.unique}</unique>\n` : '';
|
|
206
|
+
const getPrecisionTag = (data) => data.precision ? `\t<precision>${data.precision}</precision>\n` : '';
|
|
207
|
+
const getScaleTag = (data) => typeof data.scale !== 'undefined' ? `\t<scale>${data.scale}</scale>\n` : '';
|
|
208
|
+
//# sourceMappingURL=templates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../src/shared/templates/templates.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,2CAA2C;AAE3C,2CAAqD;AACrD,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,IAAI,CAAC,oCAAoC,EAAE,UAAU,EAAE,CAAC,oBAAoB,CAAC,CAAC,CAAC;AAGzG;;;;;GAKG;AACI,MAAM,eAAe,GAAG,CAC7B,EAAE,KAAK,EAAE,WAAW,EAA0C,EAC9D,UAAkB,EACV,EAA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,EAAE,CACnD,OAAO,IAAI,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,aAAa,IAAI,CAAC,MAAM,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC;AAEhF,MAAM,eAAe,GAAG,CAAC,IAAiB,EAAU,EAAE,CACpD,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,gBAAgB,IAAI,CAAC,SAAS,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC;AAEvE,MAAM,WAAW,GAAG,CAAC,IAAiB,EAAU,EAAE,CAChD,OAAO,IAAI,CAAC,KAAK,KAAK,WAAW,CAAC,CAAC,CAAC,YAAY,IAAI,CAAC,KAAK,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# summary
|
|
2
|
+
|
|
3
|
+
Generate a field for a custom metadata type based on the provided field type.
|
|
4
|
+
|
|
5
|
+
# description
|
|
6
|
+
|
|
7
|
+
Similar to a custom object, a custom metadata type has a list of custom fields that represent aspects of the metadata.
|
|
8
|
+
|
|
9
|
+
This command creates a metadata file that describes the new custom metadata type field. By default, the file is created in a "fields" directory in the current directory. Use the --output-directory to generate the file in the directory that contains the custom metadata type metdata files, such as "force-app/main/default/objects/MyCmdt\_\_mdt" for the custom metadata type called MyCmdt.
|
|
10
|
+
|
|
11
|
+
# examples
|
|
12
|
+
|
|
13
|
+
- Generate a metadata file for a custom checkbox field and add the file to the MyCmdt\_\_mdt/fields directory:
|
|
14
|
+
|
|
15
|
+
<%= config.bin %> <%= command.id %> --name MyCheckboxField --type Checkbox --output-directory force-app/main/default/objects/MyCmdt\_\_mdt
|
|
16
|
+
|
|
17
|
+
- Generate a metadata file for a custom picklist field and add a few values:
|
|
18
|
+
|
|
19
|
+
<%= config.bin %> <%= command.id %> --name MyPicklistField --type Picklist --picklist-values A --picklist-values B --picklist-values C --output-directory force-app/main/default/objects/MyCmdt\_\_mdt
|
|
20
|
+
|
|
21
|
+
- Generate a metadata file for a custom number field and specify 2 decimal places:
|
|
22
|
+
|
|
23
|
+
<%= config.bin %> <%= command.id %> --name MyNumberField --type Number --decimal-places 2 --output-directory force-app/main/default/objects/MyCmdt\_\_mdt
|
|
24
|
+
|
|
25
|
+
# flags.name.summary
|
|
26
|
+
|
|
27
|
+
Unique name for the field.
|
|
28
|
+
|
|
29
|
+
# flags.type.summary
|
|
30
|
+
|
|
31
|
+
Type of the field.
|
|
32
|
+
|
|
33
|
+
# flags.type.description
|
|
34
|
+
|
|
35
|
+
You can't use this command to create a custom metadata type field of type "Metadata Relationship". Use the Salesforce Setup UI instead.
|
|
36
|
+
|
|
37
|
+
# flags.picklist-values.summary
|
|
38
|
+
|
|
39
|
+
Picklist values; required for picklist fields.
|
|
40
|
+
|
|
41
|
+
# flags.decimal-places.summary
|
|
42
|
+
|
|
43
|
+
Number of decimal places to use for number or percent fields.
|
|
44
|
+
|
|
45
|
+
# flags.decimal-places.description
|
|
46
|
+
|
|
47
|
+
The value must be greater than or equal to zero. Default value is 0.
|
|
48
|
+
|
|
49
|
+
# flags.label.summary
|
|
50
|
+
|
|
51
|
+
Label for the field.
|
|
52
|
+
|
|
53
|
+
# flags.output-directory.summary
|
|
54
|
+
|
|
55
|
+
Directory to store newly-created field definition files.
|
|
56
|
+
|
|
57
|
+
# flags.output-directory.description
|
|
58
|
+
|
|
59
|
+
New files are automatically created in the "fields" directory. The location can be an absolute path or relative to the current working directory. The default is the current directory.
|
|
60
|
+
|
|
61
|
+
# invalidCustomFieldError
|
|
62
|
+
|
|
63
|
+
'%s' is an invalid field. Custom fields must contain only alphanumeric characters, must begin with a letter, can't end with an underscore, and can't contain two consecutive underscore characters.
|
|
64
|
+
|
|
65
|
+
# picklistValuesNotSuppliedError
|
|
66
|
+
|
|
67
|
+
You must specify at least one picklist value when the field type is picklist.
|
|
68
|
+
|
|
69
|
+
# targetDirectory
|
|
70
|
+
|
|
71
|
+
target dir = %s
|
|
72
|
+
|
|
73
|
+
# fileCreated
|
|
74
|
+
|
|
75
|
+
created %s
|
|
76
|
+
|
|
77
|
+
# fileUpdate
|
|
78
|
+
|
|
79
|
+
updated %s
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# summary
|
|
2
|
+
|
|
3
|
+
Generate a custom metadata type and all its records from a Salesforce object.
|
|
4
|
+
|
|
5
|
+
# description
|
|
6
|
+
|
|
7
|
+
Use this command to migrate existing custom objects or custom settings in an org to custom metadata types. If a field of the Salesforce object is of an unsupported type, the field type is automatically converted to text. Run "<%= config.bin %> cmdt field create --help" to see the list of supported cmdt field types, listed in the --type flag summary. Use the --ignore-unsupported to ignore these fields.
|
|
8
|
+
|
|
9
|
+
This command creates the metadata files that describe the new custom metadata type and its fields in the "force-app/main/default/objects/TypeName\_\_mdt" directory by default, where "TypeName" is the value of the required --dev-name flag. Use --type-output-directory to create them in a different directory.
|
|
10
|
+
|
|
11
|
+
# examples
|
|
12
|
+
|
|
13
|
+
- Generate a custom metadata type from a custom object called MySourceObject\_\_c in your default org:
|
|
14
|
+
|
|
15
|
+
<%= config.bin %> <%= command.id %> --dev-name MyCMDT --sobject MySourceObject\_\_c
|
|
16
|
+
|
|
17
|
+
- Generate a custom metadata type from a custom object in an org with alias my-scratch-org; ignore unsupported field types instead of converting them to text:
|
|
18
|
+
|
|
19
|
+
<%= config.bin %> <%= command.id %> --dev-name MyCMDT --sobject MySourceObject\_\_c --ignore-unsupported --target-org my-scratch-org
|
|
20
|
+
|
|
21
|
+
- Generate a protected custom metadata type from a custom object:
|
|
22
|
+
|
|
23
|
+
<%= config.bin %> <%= command.id %> --dev-name MyCMDT --sobject MySourceObject\_\_c --visibility Protected
|
|
24
|
+
|
|
25
|
+
- Generate a protected custom metadata type from a custom setting with a specific singular and plural label:
|
|
26
|
+
|
|
27
|
+
<%= config.bin %> <%= command.id %> --dev-name MyCMDT --label "My CMDT" --plural-label "My CMDTs" --sobject MySourceSetting\_\_c --visibility Protected
|
|
28
|
+
|
|
29
|
+
- Generate a custom metadata type and put the resulting metadata files in the specified directory:
|
|
30
|
+
|
|
31
|
+
<%= config.bin %> <%= command.id %> --dev-name MyCMDT --sobject MySourceObject\_\_c --type-output-directory path/to/my/cmdt/directory
|
|
32
|
+
|
|
33
|
+
- Generate a custom metadata type and put the resulting record metadata file(s) in the specified directory:
|
|
34
|
+
|
|
35
|
+
<%= config.bin %> <%= command.id %> --dev-name MyCMDT --sobject MySourceObject\_\_c --records-output-dir path/to/my/cmdt/record/directory
|
|
36
|
+
|
|
37
|
+
# flags.visibility.summary
|
|
38
|
+
|
|
39
|
+
Who can see the custom metadata type.
|
|
40
|
+
|
|
41
|
+
# flags.visibility.description
|
|
42
|
+
|
|
43
|
+
For more information on what each option means, see this topic in Salesforce Help: https://help.salesforce.com/s/articleView?id=sf.custommetadatatypes_ui_create.htm&type=5.
|
|
44
|
+
|
|
45
|
+
# flags.dev-name.summary
|
|
46
|
+
|
|
47
|
+
Name of the custom metadata type.
|
|
48
|
+
|
|
49
|
+
# flags.label.summary
|
|
50
|
+
|
|
51
|
+
Label for the custom metadata type.
|
|
52
|
+
|
|
53
|
+
# flags.plural-label.summary
|
|
54
|
+
|
|
55
|
+
Plural version of the label value; if blank, uses label.
|
|
56
|
+
|
|
57
|
+
# flags.sobject.summary
|
|
58
|
+
|
|
59
|
+
API name of the source Salesforce object used to generate the custom metadata type.
|
|
60
|
+
|
|
61
|
+
# flags.ignore-unsupported.summary
|
|
62
|
+
|
|
63
|
+
Ignore unsupported field types.
|
|
64
|
+
|
|
65
|
+
# flags.ignore-unsupported.description
|
|
66
|
+
|
|
67
|
+
In this context, "ignore" means that the fields aren't created. The default behavior is to create fields of type text and convert the field values to text.
|
|
68
|
+
|
|
69
|
+
# flags.type-output-directory.summary
|
|
70
|
+
|
|
71
|
+
Directory to store newly-created custom metadata type files.
|
|
72
|
+
|
|
73
|
+
# flags.records-output-dir.summary
|
|
74
|
+
|
|
75
|
+
Directory to store newly-created custom metadata record files.
|
|
76
|
+
|
|
77
|
+
# sobjectnameNoResultError
|
|
78
|
+
|
|
79
|
+
No sObject with name %s found in the org.
|
|
80
|
+
|
|
81
|
+
# generateError
|
|
82
|
+
|
|
83
|
+
Failed to generate custom metadata. Reason: %s.
|
|
84
|
+
|
|
85
|
+
# customSettingTypeError
|
|
86
|
+
|
|
87
|
+
Cannot generate custom metadata for the custom setting %s. Check type and visibility.
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# summary
|
|
2
|
+
|
|
3
|
+
Generate a new custom metadata type in the current project.
|
|
4
|
+
|
|
5
|
+
# description
|
|
6
|
+
|
|
7
|
+
This command creates a metadata file that describes the new custom metadata type. By default, the file is created in the MyCustomType\_\_mdt directory in the current directory, where MyCustomType is the value of the required --type-name flag. Use the --output-directory to generate the file in a package directory with other custom metadata types, such as "force-app/main/default/objects".
|
|
8
|
+
|
|
9
|
+
# examples
|
|
10
|
+
|
|
11
|
+
- Generate a custom metadata type with developer name 'MyCustomType'; this name is also used as the label:
|
|
12
|
+
|
|
13
|
+
<%= config.bin %> <%= command.id %> --type-name MyCustomType
|
|
14
|
+
|
|
15
|
+
- Generate a protected custom metadata type with a specific label:
|
|
16
|
+
|
|
17
|
+
<%= config.bin %> <%= command.id %> --type-name MyCustomType --label "Custom Type" --plural-label "Custom Types" --visibility Protected
|
|
18
|
+
|
|
19
|
+
# flags.type-name.summary
|
|
20
|
+
|
|
21
|
+
Unique object name for the custom metadata type.
|
|
22
|
+
|
|
23
|
+
# flags.type-name.description
|
|
24
|
+
|
|
25
|
+
The name can contain only underscores and alphanumeric characters, and must be unique in your org. It must begin with a letter, not include spaces, not end with an underscore, and not contain two consecutive underscores.
|
|
26
|
+
|
|
27
|
+
# flags.label.summary
|
|
28
|
+
|
|
29
|
+
Label for the custom metadata type.
|
|
30
|
+
|
|
31
|
+
# flags.plural-label.summary
|
|
32
|
+
|
|
33
|
+
Plural version of the label value; if blank, uses label.
|
|
34
|
+
|
|
35
|
+
# flags.visibility.summary
|
|
36
|
+
|
|
37
|
+
Who can see the custom metadata type.
|
|
38
|
+
|
|
39
|
+
# flags.visibility.description
|
|
40
|
+
|
|
41
|
+
For more information on what each option means, see this topic in Salesforce Help: https://help.salesforce.com/s/articleView?id=sf.custommetadatatypes_ui_create.htm&type=5.
|
|
42
|
+
|
|
43
|
+
# flags.output-directory.summary
|
|
44
|
+
|
|
45
|
+
Directory to store the newly-created custom metadata type files
|
|
46
|
+
|
|
47
|
+
# flags.output-directory.description
|
|
48
|
+
|
|
49
|
+
The location can be an absolute path or relative to the current working directory. The default is the current directory.
|
|
50
|
+
|
|
51
|
+
# successResponse
|
|
52
|
+
|
|
53
|
+
Created custom metadata type with object name '%s', label '%s', plural label '%s', and visibility '%s' at '%s'.
|
|
54
|
+
|
|
55
|
+
# errorNotValidLabelName
|
|
56
|
+
|
|
57
|
+
'%s' is too long to be a label. The maximum length of the label is 40 characters.
|
|
58
|
+
|
|
59
|
+
# errorNotValidPluralLabelName
|
|
60
|
+
|
|
61
|
+
'%s' is too long to be a plural label. The maximum length of the plural label is 40 characters.
|
|
62
|
+
|
|
63
|
+
# targetDirectory
|
|
64
|
+
|
|
65
|
+
target dir = %s
|
|
66
|
+
|
|
67
|
+
# fileCreated
|
|
68
|
+
|
|
69
|
+
created %s
|
|
70
|
+
|
|
71
|
+
# fileUpdate
|
|
72
|
+
|
|
73
|
+
updated %s
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# summary
|
|
2
|
+
|
|
3
|
+
Generate a new record for a given custom metadata type in the current project.
|
|
4
|
+
|
|
5
|
+
# description
|
|
6
|
+
|
|
7
|
+
The custom metadata type must already exist in your project. You must specify a name for the new record. Use name=value pairs to specify the values for the fields, such as MyTextField="some text here" or MyNumberField=32.
|
|
8
|
+
|
|
9
|
+
# examples
|
|
10
|
+
|
|
11
|
+
- Create a record metadata file for custom metadata type 'MyCMT' with specified values for two custom fields:
|
|
12
|
+
|
|
13
|
+
<%= config.bin %> <%= command.id %> --type-name MyCMT\_\_mdt --record-name MyRecord My_Custom_Field_1=Foo My_Custom_Field_2=Bar
|
|
14
|
+
|
|
15
|
+
- Create a protected record metadata file for custom metadata type 'MyCMT' with a specific label and values specified for two custom fields:
|
|
16
|
+
|
|
17
|
+
<%= config.bin %> <%= command.id %> --type-name MyCMT\_\_mdt --record-name MyRecord --label "My Record" --protected true My_Custom_Field_1=Foo My_Custom_Field_2=Bar
|
|
18
|
+
|
|
19
|
+
# flags.type-name.summary
|
|
20
|
+
|
|
21
|
+
API name of the custom metadata type to create a record for; must end in "\_\_mdt".
|
|
22
|
+
|
|
23
|
+
# flags.record-name.summary
|
|
24
|
+
|
|
25
|
+
Name of the new record.
|
|
26
|
+
|
|
27
|
+
# flags.label.summary
|
|
28
|
+
|
|
29
|
+
Label for the new record.
|
|
30
|
+
|
|
31
|
+
# flags.protected.summary
|
|
32
|
+
|
|
33
|
+
Protect the record when it's in a managed package.
|
|
34
|
+
|
|
35
|
+
# flags.protected.description
|
|
36
|
+
|
|
37
|
+
Protected records can only be accessed by code in the same managed package namespace.
|
|
38
|
+
|
|
39
|
+
# flags.input-directory.summary
|
|
40
|
+
|
|
41
|
+
Directory from which to get the custom metadata type definition from.
|
|
42
|
+
|
|
43
|
+
# flags.output-directory.summary
|
|
44
|
+
|
|
45
|
+
Directory to store newly-created custom metadata record files.
|
|
46
|
+
|
|
47
|
+
# successResponse
|
|
48
|
+
|
|
49
|
+
Created custom metadata record of the type '%s' with record name '%s', label '%s', and protected '%s' at '%s'.
|
|
50
|
+
|
|
51
|
+
# notAValidLabelNameError
|
|
52
|
+
|
|
53
|
+
'%s' is too long to be a label. The maximum length of the label is 40 characters.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# summary
|
|
2
|
+
|
|
3
|
+
Generate new custom metadata type records from a CSV file.
|
|
4
|
+
|
|
5
|
+
# description
|
|
6
|
+
|
|
7
|
+
The custom metadata type must already exist in your project. By default, the Name column is used to determine the record name; use the --name-column flag to specify a different column.
|
|
8
|
+
|
|
9
|
+
# examples
|
|
10
|
+
|
|
11
|
+
- Generate record metadata files from values in a CSV file for the custom metadata type MyCmdt. Use 'Name' as the column that specifies the record name:
|
|
12
|
+
|
|
13
|
+
<%= config.bin %> <%= command.id %> --csv path/to/my.csv --type-name MyCmdt
|
|
14
|
+
|
|
15
|
+
- Generate record metadata files from a CSV file in the directory different from the default, and use 'PrimaryKey' as the column that specifies the record name:
|
|
16
|
+
|
|
17
|
+
<%= config.bin %> <%= command.id %> --csv path/to/my.csv --type-name MyCmdt --input-directory path/to/my/cmdt/directory --name-column "PrimaryKey"
|
|
18
|
+
|
|
19
|
+
# flags.csv.summary
|
|
20
|
+
|
|
21
|
+
Pathname of the CSV file.
|
|
22
|
+
|
|
23
|
+
# flags.input-directory.summary
|
|
24
|
+
|
|
25
|
+
Directory from which to get the custom metadata type definition from.
|
|
26
|
+
|
|
27
|
+
# flags.output-directory.summary
|
|
28
|
+
|
|
29
|
+
Directory to store newly-created custom metadata record files.
|
|
30
|
+
|
|
31
|
+
# flags.type-name.summary
|
|
32
|
+
|
|
33
|
+
API name of the custom metadata type to create a record for.
|
|
34
|
+
|
|
35
|
+
# flags.type-name.description
|
|
36
|
+
|
|
37
|
+
The '\_\_mdt' suffix is appended to the end of the name if it's omitted.
|
|
38
|
+
|
|
39
|
+
# flags.name-column.summary
|
|
40
|
+
|
|
41
|
+
Column used to determine the name of the record.
|
|
42
|
+
|
|
43
|
+
# successResponse
|
|
44
|
+
|
|
45
|
+
Created custom metadata type records from '%s' at '%s'.
|
|
46
|
+
|
|
47
|
+
# fieldNotFoundError
|
|
48
|
+
|
|
49
|
+
The column %s is not found on the custom metadata type %s.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# sobjectnameFlagError
|
|
2
|
+
|
|
3
|
+
Not a valid custom setting/custom object name: %s
|
|
4
|
+
|
|
5
|
+
# invalidCMDTApiName
|
|
6
|
+
|
|
7
|
+
'%s' is not a valid API name for a custom metadata type. Metadata names can contain only underscores and alphanumeric characters, must begin with a letter, cannot end with an underscore, and cannot contain two consecutive underscore characters.
|
|
8
|
+
|
|
9
|
+
# notAValidRecordNameError
|
|
10
|
+
|
|
11
|
+
'%s' is not a valid record name for a custom metadata record. Record names can only contain alphanumeric characters, must begin with a letter, cannot end with an underscore, and cannot contain two consecutive underscore characters.
|