Skip to content

Commit

Permalink
Automatically request SObject type when data export from an SObject r…
Browse files Browse the repository at this point in the history
…ecord (#45)
  • Loading branch information
dufoli committed Oct 18, 2023
1 parent 172cee2 commit afa2fdb
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
- Update pop-up release note link to github pages
- Detect SObject on listview page [feature 121](https://github.com/tprouvot/Salesforce-Inspector-reloaded/issues/121) (idea by [Mehdi Cherfaoui](https://github.com/mehdisfdc))
- Automate test setup manual step of contact to multiple accounts [Aidan Majewski](https://github.com/aimaj)
- Automatically request SObject type when data export from an SObject record [feature 45](https://github.com/tprouvot/Salesforce-Inspector-reloaded/issues/45)

## Version 1.19

Expand Down
4 changes: 2 additions & 2 deletions addon/inspect.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,9 @@ class Model {
if (!objectName) {
return undefined;
}
let query = "select Id from " + objectName;
let query = "SELECT Id FROM " + objectName;
if (this.recordData && this.recordData.Id) {
query += " where Id = '" + this.recordData.Id + "'";
query += " WHERE Id = '" + this.recordData.Id + "'";
}
return this.dataExportUrl(query);
}
Expand Down
15 changes: 14 additions & 1 deletion addon/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,19 @@ class App extends React.PureComponent {
addonVersion
} = this.props;
let {isInSetup, contextUrl, apiVersionInput} = this.state;
let recordId = getRecordId(contextUrl);
let path = getSfPathFromUrl(contextUrl);
let sobject = getSobject(contextUrl);
let exportArg = new URLSearchParams();
exportArg.set("host", sfHost);
if (!sobject) {
let query = "SELECT Id FROM " + sobject;
if (!recordId) {
query += " WHERE Id = '" + recordId + "'";
}
exportArg.set("query", query);
}

let clientId = localStorage.getItem(sfHost + "_clientId");
let orgInstance = this.getOrgInstance(sfHost);
let hostArg = new URLSearchParams();
Expand Down Expand Up @@ -182,7 +195,7 @@ class App extends React.PureComponent {
h(AllDataBox, {ref: "showAllDataBox", sfHost, showDetailsSupported: !inLightning && !inInspector, linkTarget, contextUrl}),
h("div", {className: "slds-p-vertical_x-small slds-p-horizontal_x-small slds-border_bottom"},
h("div", {className: "slds-m-bottom_xx-small"},
h("a", {ref: "dataExportBtn", href: "data-export.html?" + hostArg, target: linkTarget, className: "page-button slds-button slds-button_neutral"}, h("span", {}, "Data ", h("u", {}, "E"), "xport"))
h("a", {ref: "dataExportBtn", href: "data-export.html?" + exportArg, target: linkTarget, className: "page-button slds-button slds-button_neutral"}, h("span", {}, "Data ", h("u", {}, "E"), "xport"))
),
h("div", {className: "slds-m-bottom_xx-small"},
h("a", {ref: "dataImportBtn", href: "data-import.html?" + hostArg, target: linkTarget, className: "page-button slds-button slds-button_neutral"}, h("span", {}, "Data ", h("u", {}, "I"), "mport"))
Expand Down

0 comments on commit afa2fdb

Please sign in to comment.