Skip to content

Commit

Permalink
auto detect import externalId field
Browse files Browse the repository at this point in the history
  • Loading branch information
dufoli committed Oct 20, 2023
1 parent 172cee2 commit 0fc2a8e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## Version 1.20

- Update to Salesforce API v 59.0 (Winter '24)
- Format relations as expected in import process [feature 26](https://github.com/tprouvot/Salesforce-Inspector-reloaded/issues/26)
- Add a parameter to activate summary view of pset / psetGroup from shortcut tab [feature 175](https://github.com/tprouvot/Salesforce-Inspector-reloaded/issues/175)
- Display record name (and link) in popup [feature 165](https://github.com/tprouvot/Salesforce-Inspector-reloaded/issues/165)
- Add documentation link to popup
Expand Down
12 changes: 11 additions & 1 deletion addon/data-import.js
Original file line number Diff line number Diff line change
Expand Up @@ -517,12 +517,22 @@ class Model {
return hasId ? true : false;
}

guessColumn (col) {
let columnName = col.split(".");
if (columnName.length == 2) {
let externalIdColumn = this.columnList().find(s => s.toLowerCase().startsWith(columnName[0].toLowerCase()) && s.toLowerCase().endsWith(columnName[1].toLowerCase()));
if (externalIdColumn) {
return externalIdColumn;
}
}
return col.trim();
}
makeColumn(column, index) {
let self = this;
let xmlName = /^[a-zA-Z_][a-zA-Z0-9_]*$/; // A (subset of a) valid XML name
let columnVm = {
columnIndex: index,
columnValue: column.trim(),
columnValue: self.guessColumn(column),
columnOriginalValue: column,
columnIgnore() { return columnVm.columnValue.startsWith("_"); },
columnSkip() {
Expand Down

0 comments on commit 0fc2a8e

Please sign in to comment.