Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] link custom setting #82

Merged
merged 8 commits into from
May 2, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix links for custom setting
MD931 committed Apr 28, 2023
commit 44ce0fbef1bc2f24a7cf331594e8883cc4447fc0
7 changes: 7 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
Version 1.17
===========

General
-------
* Fix links for custom setting [PR81](https://github.com/tprouvot/Salesforce-Inspector-reloaded/pull/81) (by [Mouloud Habchi](https://github.com/MD931) )

Version 1.16
===========

26 changes: 17 additions & 9 deletions addon/popup.js
Original file line number Diff line number Diff line change
@@ -282,7 +282,7 @@ class AllDataBox extends React.PureComponent {
loadSobjects() {
let entityMap = new Map();

function addEntity({ name, label, keyPrefix, durableId }, api) {
function addEntity({ name, label, keyPrefix, durableId, isCustomSetting }, api) {
label = label || ""; // Avoid null exceptions if the object does not have a label (some don't). All objects have a name. Not needed for keyPrefix since we only do equality comparisons on those.
let entity = entityMap.get(name);
if (entity) {
@@ -299,6 +299,7 @@ class AllDataBox extends React.PureComponent {
label,
keyPrefix,
durableId,
isCustomSetting,
availableKeyPrefix: null,
};
entityMap.set(name, entity);
@@ -322,14 +323,15 @@ class AllDataBox extends React.PureComponent {
}

function getEntityDefinitions(bucket) {
let query = "select QualifiedApiName, Label, KeyPrefix, DurableId from EntityDefinition" + bucket;
let query = "select QualifiedApiName, Label, KeyPrefix, DurableId, IsCustomSetting from EntityDefinition" + bucket;
return sfConn.rest("/services/data/v" + apiVersion + "/tooling/query?q=" + encodeURIComponent(query)).then(res => {
for (let record of res.records) {
addEntity({
name: record.QualifiedApiName,
label: record.Label,
keyPrefix: record.KeyPrefix,
durableId: record.DurableId
durableId: record.DurableId,
isCustomSetting: record.IsCustomSetting
}, null);
}
}).catch(err => {
@@ -986,26 +988,32 @@ class AllDataSelection extends React.PureComponent {
/**
* Optimistically generate lightning setup uri for the provided object api name.
*/
getObjectSetupLink(sobjectName, durableId) {
getObjectSetupLink(sobjectName, durableId, isCustomSetting) {
if (sobjectName.endsWith("__mdt")) {
return this.getCustomMetadataLink(durableId);
} else if(isCustomSetting) {
return "https://" + this.props.sfHost + "/lightning/setup/CustomSettings/page?address=%2F"+ durableId +"?setupid=CustomSettings";
MD931 marked this conversation as resolved.
Show resolved Hide resolved
} else {
return "https://" + this.props.sfHost + "/lightning/setup/ObjectManager/" + sobjectName + "/Details/view";
}
}
getCustomMetadataLink(durableId) {
return "https://" + this.props.sfHost + "/lightning/setup/CustomMetadata/page?address=%2F" + durableId + "%3Fsetupid%3DCustomMetadata";
}
getObjectFieldsSetupLink(sobjectName, durableId) {
getObjectFieldsSetupLink(sobjectName, durableId, isCustomSetting) {
if (sobjectName.endsWith("__mdt")) {
return this.getCustomMetadataLink(durableId);
} else if(isCustomSetting) {
return "https://" + this.props.sfHost + "/lightning/setup/CustomSettings/page?address=%2F"+ durableId +"?setupid=CustomSettings";
MD931 marked this conversation as resolved.
Show resolved Hide resolved
} else {
return "https://" + this.props.sfHost + "/lightning/setup/ObjectManager/" + sobjectName + "/FieldsAndRelationships/view";
}
}
getObjectListLink(sobjectName, keyPrefix) {
getObjectListLink(sobjectName, keyPrefix, isCustomSetting) {
if (sobjectName.endsWith("__mdt")) {
return "https://" + this.props.sfHost + "/lightning/setup/CustomMetadata/page?address=%2F" + keyPrefix;
} else if(isCustomSetting) {
return "https://" + this.props.sfHost + "/lightning/setup/CustomSettings/page?address=%2Fsetup%2Fui%2FlistCustomSettingsData.apexp?id=" + keyPrefix;
MD931 marked this conversation as resolved.
Show resolved Hide resolved
} else {
return "https://" + this.props.sfHost + "/lightning/o/" + sobjectName + "/list";
}
@@ -1030,15 +1038,15 @@ class AllDataSelection extends React.PureComponent {
h("tr", {},
h("th", {}, "Name:"),
h("td", {},
h("a", { href: this.getObjectSetupLink(selectedValue.sobject.name, selectedValue.sobject.durableId), target: linkTarget }, selectedValue.sobject.name)
h("a", { href: this.getObjectSetupLink(selectedValue.sobject.name, selectedValue.sobject.durableId, selectedValue.sobject.isCustomSetting), target: linkTarget }, selectedValue.sobject.name)
)
),
h("tr", {},
h("th", {}, "Links:"),
h("td", {},
h("a", { href: this.getObjectFieldsSetupLink(selectedValue.sobject.name, selectedValue.sobject.durableId), target: linkTarget }, "Fields / "),
h("a", { href: this.getObjectFieldsSetupLink(selectedValue.sobject.name, selectedValue.sobject.durableId, selectedValue.sobject.isCustomSetting), target: linkTarget }, "Fields / "),
h("a", { href: this.getRecordTypesLink(sfHost, selectedValue.sobject.name), target: linkTarget }, "Record Types / "),
h("a", { href: this.getObjectListLink(selectedValue.sobject.name, selectedValue.sobject.keyPrefix), target: linkTarget }, "Object List")
h("a", { href: this.getObjectListLink(selectedValue.sobject.name, selectedValue.sobject.keyPrefix, selectedValue.sobject.isCustomSetting), target: linkTarget }, "Object List")
),
),
h("tr", {},