Skip to content

Commit e15bddf

Browse files
authored
Merge pull request #514 from forcedotcom/#512
fix: #512
2 parents d9b8948 + 8a41277 commit e15bddf

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

src/modules/components/common_components/statics.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export const CONSTANTS = {
3939
COMPLEX_FIELDS_SEPARATOR: ';',
4040
REFERENCE_FIELD_OBJECT_SEPARATOR: '$',
4141
FIELDS_MAPPING_REGEX_PATTERN: '^\/(.*)\/$',
42+
FIELDS_MAPPING_EVAL_PATTERN: '^eval(\(.*\))$',
4243

4344
SCRIPT_FILE_NAME: 'export.json',
4445

src/modules/models/job_models/migrationJobTask.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1860,6 +1860,15 @@ export default class MigrationJobTask {
18601860
newValue = newValue == 'TRUE' || newValue == 'true' ? true :
18611861
newValue == 'FALSE' || newValue == 'false' ? false :
18621862
newValue == 'null' || newValue == 'NULL' || newValue == 'undefined' || newValue == '#N/A' || newValue == undefined ? null : newValue;
1863+
1864+
// Eval
1865+
if (new RegExp(CONSTANTS.FIELDS_MAPPING_EVAL_PATTERN).test(newValue)) {
1866+
let expr = newValue.replace(new RegExp(CONSTANTS.FIELDS_MAPPING_EVAL_PATTERN), '$1');
1867+
try {
1868+
newValue = eval(expr);
1869+
} catch (ex) { }
1870+
}
1871+
18631872
if (typeof newValue != 'undefined') {
18641873
record[field] = newValue;
18651874
}

0 commit comments

Comments
 (0)