Skip to content

Commit

Permalink
Feature/remove formula fields from export auto complete (#415)
Browse files Browse the repository at this point in the history
## Describe your changes

## Issue ticket number and link

## Checklist before requesting a review
- [ ] I have read and understand the [Contributions
section](https://github.com/tprouvot/Salesforce-Inspector-reloaded#contributions)
- [ ] Target branch is releaseCandidate and not master
- [ ] I have performed a self-review of my code
- [ ] I ran the [unit
tests](https://github.com/tprouvot/Salesforce-Inspector-reloaded#unit-tests)
and my PR does not break any tests
- [ ] I documented the changes I've made on the
[CHANGES.md](https://github.com/tprouvot/Salesforce-Inspector-reloaded/blob/master/CHANGES.md)
and followed actual conventions
- [ ] I added a new section on
[how-to.md](https://github.com/tprouvot/Salesforce-Inspector-reloaded/blob/master/docs/how-to.md)
(optional)
  • Loading branch information
tprouvot authored May 6, 2024
1 parent 1be3b64 commit 288b526
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Release Notes

## Version 1.24

- Add option to exclude formula fields from data export autocomplete. [feature 415](https://github.com/tprouvot/Salesforce-Inspector-reloaded/issues/415)
- Trim the userQuery before make the search. [feature 410](https://github.com/tprouvot/Salesforce-Inspector-reloaded/issues/410) (contribution by [César Blanco](https://github.com/cesarblancg))
- Add setup menu items 'Trusted URLs' and 'Trusted URL and Browser Policy Violations' to shortcut links
- Ability to quit popup with escape button [feature 378](https://github.com/tprouvot/Salesforce-Inspector-reloaded/issues/378) (contribution by [Gerald Gramier](https://github.com/gramier))
Expand Down
3 changes: 2 additions & 1 deletion addon/data-export.js
Original file line number Diff line number Diff line change
Expand Up @@ -766,9 +766,10 @@ class Model {
} else {
// Autocomplete field names and functions
if (ctrlSpace) {
let includeFormula = localStorage.getItem("includeFormulaFieldsFromExportAutocomplete") !== "false";
let ar = contextSobjectDescribes
.flatMap(sobjectDescribe => sobjectDescribe.fields)
.filter(field => field.name.toLowerCase().includes(searchTerm.toLowerCase()) || field.label.toLowerCase().includes(searchTerm.toLowerCase()))
.filter(field => (field.name.toLowerCase().includes(searchTerm.toLowerCase()) || field.label.toLowerCase().includes(searchTerm.toLowerCase())) && (includeFormula || !field.calculated))
.map(field => contextPath + field.name)
.toArray();
if (ar.length > 0) {
Expand Down
1 change: 1 addition & 0 deletions addon/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ class OptionsTabSelector extends React.Component {
{option: Option, props: {type: "toggle", title: "Display Query Execution Time", key: "displayQueryPerformance", default: true}},
{option: Option, props: {type: "toggle", title: "Use SObject context on Data Export ", key: "useSObjectContextOnDataImportLink", default: true}},
{option: Option, props: {type: "toggle", title: "Show 'Delete Records' button ", key: "showDeleteRecordsButton", default: true}},
{option: Option, props: {type: "toggle", title: "Include formula fields from suggestion", key: "includeFormulaFieldsFromExportAutocomplete", default: true}},
{option: Option, props: {type: "text", title: "Query Templates", key: "queryTemplates", placeholder: "SELECT Id FROM// SELECT Id FROM WHERE//SELECT Id FROM WHERE IN//SELECT Id FROM WHERE LIKE//SELECT Id FROM ORDER BY//SELECT ID FROM MYTEST__c//SELECT ID WHERE"}}
]
},
Expand Down
6 changes: 6 additions & 0 deletions docs/how-to.md
Original file line number Diff line number Diff line change
Expand Up @@ -249,3 +249,9 @@ When on the export page, put the cursor between `SaELECT` and `FROM` and press `
If you want to insert only custom fields, enter `__c` between `SELECT` and `FROM`.

![2024-04-16_08-53-32 (1)](https://github.com/tprouvot/Salesforce-Inspector-reloaded/assets/35368290/ef7ba7a0-c9c4-4573-9aaa-b72e64430f64)

## Exclude formula fields from data export autocomplete

You can exclude formula fields to be included in the autocomplete by disable the toogle

<img width="898" alt="image" src="https://github.com/tprouvot/Salesforce-Inspector-reloaded/assets/35368290/aa9db6c4-099d-49ea-a343-7c64e472450d">

0 comments on commit 288b526

Please sign in to comment.