SOQL Query (or other means) to get the icon assigned to an objectVisualforce and Lightning Componets: how to get the Lightning-Icon Name on a VF-Page (or LC) for any custom object?Visualforce - Apex - Google mapsHow to get the referenced field's name value when the field is referencing multiple typesApex Managed Sharing Rule to share master object after insert of detail objectWhat does this error mean - SOQL statements cannot query more than 35 different parent types?Subquery in Junction Object, can't get relationshipCreate custom 'Tab Style Selector' using apiGet Custom Object full IdUpdating a related record in a triggerCross-Object SOQL QueryVisualforce and Lightning Componets: how to get the Lightning-Icon Name on a VF-Page (or LC) for any custom object?
Email about missed connecting flight compensation 5 months after flight, is there a point?
How to check the quality of an audio sample?
What could be some effects of (physical) Mana consumption that prevent long term abuse?
Why isn't there research to build a standard lunar, or Martian mobility platform?
How can I deal with a player trying to insert real-world mythology into my homebrew setting?
Was the Ford Model T black because of the speed black paint dries?
Where or how can I find what interfaces an out of the box Apex class implements?
Replacements for swear words
Wrapper in return method for test class
Is this floating-point optimization allowed?
Repeating redundant information after dialogues, to avoid or not?
Why can't supermassive black holes merge? (or can they?)
What would be the ideal melee weapon made of "Phase Metal"?
Why does Hellboy file down his horns?
Password maker in c#
Is killing off one of my queer characters homophobic?
Grammy Winners Grading
Bishop game - python
Shortest distance around a pyramid
Why does resistance reduce when a conductive fabric is stretched?
A DVR algebra with weird automorphisms
Cops: The Hidden OEIS Substring
How might the United Kingdom become a republic?
Can I use "candidate" as a verb?
SOQL Query (or other means) to get the icon assigned to an object
Visualforce and Lightning Componets: how to get the Lightning-Icon Name on a VF-Page (or LC) for any custom object?Visualforce - Apex - Google mapsHow to get the referenced field's name value when the field is referencing multiple typesApex Managed Sharing Rule to share master object after insert of detail objectWhat does this error mean - SOQL statements cannot query more than 35 different parent types?Subquery in Junction Object, can't get relationshipCreate custom 'Tab Style Selector' using apiGet Custom Object full IdUpdating a related record in a triggerCross-Object SOQL QueryVisualforce and Lightning Componets: how to get the Lightning-Icon Name on a VF-Page (or LC) for any custom object?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
Lightning has pre-defined icons for the various standard object types (e.g. Account has the big and small buildings icon) and seems to allow you to associate an icon with a custom object by creating a custom object tab for the given object type.
I am looking for a way to programmatically access the icon detail (in Apex or in some LWC custom component) in a way I can then use that with LWC's lightning-icon component. I first thought about querying with SOQL, but some other means is also fine.
I'm probably looking in completely the wrong place, but here's what I've discovered so far...
I can't find a way to get the icon identities for standard object types. I can live with that since we only use a small number of these in our applications (such as Account, for example) so I can hard-code that "lookup". However, I do want to dynamically use the icons that have been assigned for custom objects.
For custom objects, as I mentioned, I can see that the CustomTab for a custom object (i.e. one named after the object itself and with "customObject" as true) has a Motif field that seems to include the icon name, mixed in with some other text. For example, I can create a custom tab for my custom object that when retrieved through the metadata API looks like:
<CustomTab xmlns="http://soap.sforce.com/2006/04/metadata">
<customObject>true</customObject>
<description>Test</description>
<motif>Custom57: Building Block</motif>
</CustomTab>
I can find "custom57" in the LDS icons library and this is the right icon for what I selected.
Now, what I can't work out is how to query the CustomTab detail since something like:
SELECT Motif FROM CustomTab WHERE customObject = TRUE AND fullName = 'MyCustomObject__c'
simply doesn't work (CustomTab is not a supported SObject type).
I have, in my quest for an answer, come across TabDefinition. This looks promising as an SOQL queryable object. However, it doesn't seem to provide the desired icon identity information.
Anyone know how to get this information programmatically?
apex lightning soql icon
add a comment |
Lightning has pre-defined icons for the various standard object types (e.g. Account has the big and small buildings icon) and seems to allow you to associate an icon with a custom object by creating a custom object tab for the given object type.
I am looking for a way to programmatically access the icon detail (in Apex or in some LWC custom component) in a way I can then use that with LWC's lightning-icon component. I first thought about querying with SOQL, but some other means is also fine.
I'm probably looking in completely the wrong place, but here's what I've discovered so far...
I can't find a way to get the icon identities for standard object types. I can live with that since we only use a small number of these in our applications (such as Account, for example) so I can hard-code that "lookup". However, I do want to dynamically use the icons that have been assigned for custom objects.
For custom objects, as I mentioned, I can see that the CustomTab for a custom object (i.e. one named after the object itself and with "customObject" as true) has a Motif field that seems to include the icon name, mixed in with some other text. For example, I can create a custom tab for my custom object that when retrieved through the metadata API looks like:
<CustomTab xmlns="http://soap.sforce.com/2006/04/metadata">
<customObject>true</customObject>
<description>Test</description>
<motif>Custom57: Building Block</motif>
</CustomTab>
I can find "custom57" in the LDS icons library and this is the right icon for what I selected.
Now, what I can't work out is how to query the CustomTab detail since something like:
SELECT Motif FROM CustomTab WHERE customObject = TRUE AND fullName = 'MyCustomObject__c'
simply doesn't work (CustomTab is not a supported SObject type).
I have, in my quest for an answer, come across TabDefinition. This looks promising as an SOQL queryable object. However, it doesn't seem to provide the desired icon identity information.
Anyone know how to get this information programmatically?
apex lightning soql icon
1
Not sure about SOQL, but you can access thethemeInfo.iconUrl
from LWClightning/uiObjectInfoApi
. For learning I had used it for porting my lookup component to lwc component (although never got chance to finish).
– Raul
Jul 4 at 11:19
Oooh, thanks for that. As I said, happy to either SOQL it or access somehow from within an LWC component. I'll go have a look and come back to you.
– Phil W
Jul 4 at 11:20
1
Interestingly this led me to salesforce.stackexchange.com/questions/190454/… (searching for themeInfo iconUrl) which ties in with Mariia's description and example of the icon URL.
– Phil W
Jul 4 at 11:32
@Raul, please could you turn your comment into an answer - it's a good way of handling it in the context of LWC.
– Phil W
Jul 4 at 12:01
add a comment |
Lightning has pre-defined icons for the various standard object types (e.g. Account has the big and small buildings icon) and seems to allow you to associate an icon with a custom object by creating a custom object tab for the given object type.
I am looking for a way to programmatically access the icon detail (in Apex or in some LWC custom component) in a way I can then use that with LWC's lightning-icon component. I first thought about querying with SOQL, but some other means is also fine.
I'm probably looking in completely the wrong place, but here's what I've discovered so far...
I can't find a way to get the icon identities for standard object types. I can live with that since we only use a small number of these in our applications (such as Account, for example) so I can hard-code that "lookup". However, I do want to dynamically use the icons that have been assigned for custom objects.
For custom objects, as I mentioned, I can see that the CustomTab for a custom object (i.e. one named after the object itself and with "customObject" as true) has a Motif field that seems to include the icon name, mixed in with some other text. For example, I can create a custom tab for my custom object that when retrieved through the metadata API looks like:
<CustomTab xmlns="http://soap.sforce.com/2006/04/metadata">
<customObject>true</customObject>
<description>Test</description>
<motif>Custom57: Building Block</motif>
</CustomTab>
I can find "custom57" in the LDS icons library and this is the right icon for what I selected.
Now, what I can't work out is how to query the CustomTab detail since something like:
SELECT Motif FROM CustomTab WHERE customObject = TRUE AND fullName = 'MyCustomObject__c'
simply doesn't work (CustomTab is not a supported SObject type).
I have, in my quest for an answer, come across TabDefinition. This looks promising as an SOQL queryable object. However, it doesn't seem to provide the desired icon identity information.
Anyone know how to get this information programmatically?
apex lightning soql icon
Lightning has pre-defined icons for the various standard object types (e.g. Account has the big and small buildings icon) and seems to allow you to associate an icon with a custom object by creating a custom object tab for the given object type.
I am looking for a way to programmatically access the icon detail (in Apex or in some LWC custom component) in a way I can then use that with LWC's lightning-icon component. I first thought about querying with SOQL, but some other means is also fine.
I'm probably looking in completely the wrong place, but here's what I've discovered so far...
I can't find a way to get the icon identities for standard object types. I can live with that since we only use a small number of these in our applications (such as Account, for example) so I can hard-code that "lookup". However, I do want to dynamically use the icons that have been assigned for custom objects.
For custom objects, as I mentioned, I can see that the CustomTab for a custom object (i.e. one named after the object itself and with "customObject" as true) has a Motif field that seems to include the icon name, mixed in with some other text. For example, I can create a custom tab for my custom object that when retrieved through the metadata API looks like:
<CustomTab xmlns="http://soap.sforce.com/2006/04/metadata">
<customObject>true</customObject>
<description>Test</description>
<motif>Custom57: Building Block</motif>
</CustomTab>
I can find "custom57" in the LDS icons library and this is the right icon for what I selected.
Now, what I can't work out is how to query the CustomTab detail since something like:
SELECT Motif FROM CustomTab WHERE customObject = TRUE AND fullName = 'MyCustomObject__c'
simply doesn't work (CustomTab is not a supported SObject type).
I have, in my quest for an answer, come across TabDefinition. This looks promising as an SOQL queryable object. However, it doesn't seem to provide the desired icon identity information.
Anyone know how to get this information programmatically?
apex lightning soql icon
apex lightning soql icon
edited Jul 4 at 11:37
Phil W
asked Jul 4 at 11:08
Phil WPhil W
2,4401 gold badge3 silver badges12 bronze badges
2,4401 gold badge3 silver badges12 bronze badges
1
Not sure about SOQL, but you can access thethemeInfo.iconUrl
from LWClightning/uiObjectInfoApi
. For learning I had used it for porting my lookup component to lwc component (although never got chance to finish).
– Raul
Jul 4 at 11:19
Oooh, thanks for that. As I said, happy to either SOQL it or access somehow from within an LWC component. I'll go have a look and come back to you.
– Phil W
Jul 4 at 11:20
1
Interestingly this led me to salesforce.stackexchange.com/questions/190454/… (searching for themeInfo iconUrl) which ties in with Mariia's description and example of the icon URL.
– Phil W
Jul 4 at 11:32
@Raul, please could you turn your comment into an answer - it's a good way of handling it in the context of LWC.
– Phil W
Jul 4 at 12:01
add a comment |
1
Not sure about SOQL, but you can access thethemeInfo.iconUrl
from LWClightning/uiObjectInfoApi
. For learning I had used it for porting my lookup component to lwc component (although never got chance to finish).
– Raul
Jul 4 at 11:19
Oooh, thanks for that. As I said, happy to either SOQL it or access somehow from within an LWC component. I'll go have a look and come back to you.
– Phil W
Jul 4 at 11:20
1
Interestingly this led me to salesforce.stackexchange.com/questions/190454/… (searching for themeInfo iconUrl) which ties in with Mariia's description and example of the icon URL.
– Phil W
Jul 4 at 11:32
@Raul, please could you turn your comment into an answer - it's a good way of handling it in the context of LWC.
– Phil W
Jul 4 at 12:01
1
1
Not sure about SOQL, but you can access the
themeInfo.iconUrl
from LWC lightning/uiObjectInfoApi
. For learning I had used it for porting my lookup component to lwc component (although never got chance to finish).– Raul
Jul 4 at 11:19
Not sure about SOQL, but you can access the
themeInfo.iconUrl
from LWC lightning/uiObjectInfoApi
. For learning I had used it for porting my lookup component to lwc component (although never got chance to finish).– Raul
Jul 4 at 11:19
Oooh, thanks for that. As I said, happy to either SOQL it or access somehow from within an LWC component. I'll go have a look and come back to you.
– Phil W
Jul 4 at 11:20
Oooh, thanks for that. As I said, happy to either SOQL it or access somehow from within an LWC component. I'll go have a look and come back to you.
– Phil W
Jul 4 at 11:20
1
1
Interestingly this led me to salesforce.stackexchange.com/questions/190454/… (searching for themeInfo iconUrl) which ties in with Mariia's description and example of the icon URL.
– Phil W
Jul 4 at 11:32
Interestingly this led me to salesforce.stackexchange.com/questions/190454/… (searching for themeInfo iconUrl) which ties in with Mariia's description and example of the icon URL.
– Phil W
Jul 4 at 11:32
@Raul, please could you turn your comment into an answer - it's a good way of handling it in the context of LWC.
– Phil W
Jul 4 at 12:01
@Raul, please could you turn your comment into an answer - it's a good way of handling it in the context of LWC.
– Phil W
Jul 4 at 12:01
add a comment |
2 Answers
2
active
oldest
votes
In LWC, its a bit easier to use lightning/uiObjectInfoApi
to get the icon information for any custom object, following is pseudo code for Account object:
import LightningElement, wire from 'lwc';
import getObjectInfo from 'lightning/uiObjectInfoApi';
import ACCOUNT_OBJECT from '@salesforce/schema/Account';
@track themeInfo;
export default class Example extends LightningElement
@wire(getObjectInfo, objectApiName: ACCOUNT_OBJECT )
handleResult(error, data)
if(data)
if(error)
// handle error
For learning I thought of porting an old custom lookup aura component to lwc, one feature was to display dynamic icon URL and my research took me too themeInfo
of uiObjectInfoApi
which I found to be quite useful. Here is the link to the project.
add a comment |
It can be retrieved, but not really clear:
SELECT (SELECT Url FROM Icons) FROM TabDefinition where IsCustom = true AND SobjectName = 'MyCustomObject__c'
You will get as a result something like this as an url:
https://site-momentum-5565-dev-ed.cs90.my.salesforce.com/img/icon/t4v35/custom/custom71_120.png
To retrieve the motif number just get substring after last '/'. And after then substring between 'custom' and '_'.
Hope it helps you solve the problem.
Thanks for the fast reply! I'm considering whether Raul's approach will work since I want to do this inside an LWC component that then uses the lightning-icon component within it. Will let you know the direction I go.
– Phil W
Jul 4 at 11:24
2
What's most interesting with this is that multiple icon URLs are returned by this query - different types and sizes (one SVG and several different PNGs that seem to be different sizes). The SVG file naming seems to closely resemble the needed "category:name" format for lightning-icon names, being like ".../custom/custom57.svg" in my case. Restricting to the SVG is easy: "SELECT (SELECT ContentType, Url FROM Icons WHERE ContentType LIKE 'image/svg%') FROM TabDefinition WHERE SobjectName = 'MyCustomObject__c'"
– Phil W
Jul 4 at 11:47
I think we are likely to go with Raul's suggestion. The reason I say this is that I'm guessing the LWC infrastructure will automatically select an appropriate format of icon based on device capabilities. However, many many thanks for your very helpful answer.
– Phil W
Jul 4 at 12:03
1
Not at all, you are welcome!
– Mariia Illarionova
Jul 4 at 12:04
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "459"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f268249%2fsoql-query-or-other-means-to-get-the-icon-assigned-to-an-object%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
In LWC, its a bit easier to use lightning/uiObjectInfoApi
to get the icon information for any custom object, following is pseudo code for Account object:
import LightningElement, wire from 'lwc';
import getObjectInfo from 'lightning/uiObjectInfoApi';
import ACCOUNT_OBJECT from '@salesforce/schema/Account';
@track themeInfo;
export default class Example extends LightningElement
@wire(getObjectInfo, objectApiName: ACCOUNT_OBJECT )
handleResult(error, data)
if(data)
if(error)
// handle error
For learning I thought of porting an old custom lookup aura component to lwc, one feature was to display dynamic icon URL and my research took me too themeInfo
of uiObjectInfoApi
which I found to be quite useful. Here is the link to the project.
add a comment |
In LWC, its a bit easier to use lightning/uiObjectInfoApi
to get the icon information for any custom object, following is pseudo code for Account object:
import LightningElement, wire from 'lwc';
import getObjectInfo from 'lightning/uiObjectInfoApi';
import ACCOUNT_OBJECT from '@salesforce/schema/Account';
@track themeInfo;
export default class Example extends LightningElement
@wire(getObjectInfo, objectApiName: ACCOUNT_OBJECT )
handleResult(error, data)
if(data)
if(error)
// handle error
For learning I thought of porting an old custom lookup aura component to lwc, one feature was to display dynamic icon URL and my research took me too themeInfo
of uiObjectInfoApi
which I found to be quite useful. Here is the link to the project.
add a comment |
In LWC, its a bit easier to use lightning/uiObjectInfoApi
to get the icon information for any custom object, following is pseudo code for Account object:
import LightningElement, wire from 'lwc';
import getObjectInfo from 'lightning/uiObjectInfoApi';
import ACCOUNT_OBJECT from '@salesforce/schema/Account';
@track themeInfo;
export default class Example extends LightningElement
@wire(getObjectInfo, objectApiName: ACCOUNT_OBJECT )
handleResult(error, data)
if(data)
if(error)
// handle error
For learning I thought of porting an old custom lookup aura component to lwc, one feature was to display dynamic icon URL and my research took me too themeInfo
of uiObjectInfoApi
which I found to be quite useful. Here is the link to the project.
In LWC, its a bit easier to use lightning/uiObjectInfoApi
to get the icon information for any custom object, following is pseudo code for Account object:
import LightningElement, wire from 'lwc';
import getObjectInfo from 'lightning/uiObjectInfoApi';
import ACCOUNT_OBJECT from '@salesforce/schema/Account';
@track themeInfo;
export default class Example extends LightningElement
@wire(getObjectInfo, objectApiName: ACCOUNT_OBJECT )
handleResult(error, data)
if(data)
if(error)
// handle error
For learning I thought of porting an old custom lookup aura component to lwc, one feature was to display dynamic icon URL and my research took me too themeInfo
of uiObjectInfoApi
which I found to be quite useful. Here is the link to the project.
answered Jul 4 at 12:14
RaulRaul
13.1k3 gold badges19 silver badges42 bronze badges
13.1k3 gold badges19 silver badges42 bronze badges
add a comment |
add a comment |
It can be retrieved, but not really clear:
SELECT (SELECT Url FROM Icons) FROM TabDefinition where IsCustom = true AND SobjectName = 'MyCustomObject__c'
You will get as a result something like this as an url:
https://site-momentum-5565-dev-ed.cs90.my.salesforce.com/img/icon/t4v35/custom/custom71_120.png
To retrieve the motif number just get substring after last '/'. And after then substring between 'custom' and '_'.
Hope it helps you solve the problem.
Thanks for the fast reply! I'm considering whether Raul's approach will work since I want to do this inside an LWC component that then uses the lightning-icon component within it. Will let you know the direction I go.
– Phil W
Jul 4 at 11:24
2
What's most interesting with this is that multiple icon URLs are returned by this query - different types and sizes (one SVG and several different PNGs that seem to be different sizes). The SVG file naming seems to closely resemble the needed "category:name" format for lightning-icon names, being like ".../custom/custom57.svg" in my case. Restricting to the SVG is easy: "SELECT (SELECT ContentType, Url FROM Icons WHERE ContentType LIKE 'image/svg%') FROM TabDefinition WHERE SobjectName = 'MyCustomObject__c'"
– Phil W
Jul 4 at 11:47
I think we are likely to go with Raul's suggestion. The reason I say this is that I'm guessing the LWC infrastructure will automatically select an appropriate format of icon based on device capabilities. However, many many thanks for your very helpful answer.
– Phil W
Jul 4 at 12:03
1
Not at all, you are welcome!
– Mariia Illarionova
Jul 4 at 12:04
add a comment |
It can be retrieved, but not really clear:
SELECT (SELECT Url FROM Icons) FROM TabDefinition where IsCustom = true AND SobjectName = 'MyCustomObject__c'
You will get as a result something like this as an url:
https://site-momentum-5565-dev-ed.cs90.my.salesforce.com/img/icon/t4v35/custom/custom71_120.png
To retrieve the motif number just get substring after last '/'. And after then substring between 'custom' and '_'.
Hope it helps you solve the problem.
Thanks for the fast reply! I'm considering whether Raul's approach will work since I want to do this inside an LWC component that then uses the lightning-icon component within it. Will let you know the direction I go.
– Phil W
Jul 4 at 11:24
2
What's most interesting with this is that multiple icon URLs are returned by this query - different types and sizes (one SVG and several different PNGs that seem to be different sizes). The SVG file naming seems to closely resemble the needed "category:name" format for lightning-icon names, being like ".../custom/custom57.svg" in my case. Restricting to the SVG is easy: "SELECT (SELECT ContentType, Url FROM Icons WHERE ContentType LIKE 'image/svg%') FROM TabDefinition WHERE SobjectName = 'MyCustomObject__c'"
– Phil W
Jul 4 at 11:47
I think we are likely to go with Raul's suggestion. The reason I say this is that I'm guessing the LWC infrastructure will automatically select an appropriate format of icon based on device capabilities. However, many many thanks for your very helpful answer.
– Phil W
Jul 4 at 12:03
1
Not at all, you are welcome!
– Mariia Illarionova
Jul 4 at 12:04
add a comment |
It can be retrieved, but not really clear:
SELECT (SELECT Url FROM Icons) FROM TabDefinition where IsCustom = true AND SobjectName = 'MyCustomObject__c'
You will get as a result something like this as an url:
https://site-momentum-5565-dev-ed.cs90.my.salesforce.com/img/icon/t4v35/custom/custom71_120.png
To retrieve the motif number just get substring after last '/'. And after then substring between 'custom' and '_'.
Hope it helps you solve the problem.
It can be retrieved, but not really clear:
SELECT (SELECT Url FROM Icons) FROM TabDefinition where IsCustom = true AND SobjectName = 'MyCustomObject__c'
You will get as a result something like this as an url:
https://site-momentum-5565-dev-ed.cs90.my.salesforce.com/img/icon/t4v35/custom/custom71_120.png
To retrieve the motif number just get substring after last '/'. And after then substring between 'custom' and '_'.
Hope it helps you solve the problem.
answered Jul 4 at 11:21
Mariia IllarionovaMariia Illarionova
8782 silver badges13 bronze badges
8782 silver badges13 bronze badges
Thanks for the fast reply! I'm considering whether Raul's approach will work since I want to do this inside an LWC component that then uses the lightning-icon component within it. Will let you know the direction I go.
– Phil W
Jul 4 at 11:24
2
What's most interesting with this is that multiple icon URLs are returned by this query - different types and sizes (one SVG and several different PNGs that seem to be different sizes). The SVG file naming seems to closely resemble the needed "category:name" format for lightning-icon names, being like ".../custom/custom57.svg" in my case. Restricting to the SVG is easy: "SELECT (SELECT ContentType, Url FROM Icons WHERE ContentType LIKE 'image/svg%') FROM TabDefinition WHERE SobjectName = 'MyCustomObject__c'"
– Phil W
Jul 4 at 11:47
I think we are likely to go with Raul's suggestion. The reason I say this is that I'm guessing the LWC infrastructure will automatically select an appropriate format of icon based on device capabilities. However, many many thanks for your very helpful answer.
– Phil W
Jul 4 at 12:03
1
Not at all, you are welcome!
– Mariia Illarionova
Jul 4 at 12:04
add a comment |
Thanks for the fast reply! I'm considering whether Raul's approach will work since I want to do this inside an LWC component that then uses the lightning-icon component within it. Will let you know the direction I go.
– Phil W
Jul 4 at 11:24
2
What's most interesting with this is that multiple icon URLs are returned by this query - different types and sizes (one SVG and several different PNGs that seem to be different sizes). The SVG file naming seems to closely resemble the needed "category:name" format for lightning-icon names, being like ".../custom/custom57.svg" in my case. Restricting to the SVG is easy: "SELECT (SELECT ContentType, Url FROM Icons WHERE ContentType LIKE 'image/svg%') FROM TabDefinition WHERE SobjectName = 'MyCustomObject__c'"
– Phil W
Jul 4 at 11:47
I think we are likely to go with Raul's suggestion. The reason I say this is that I'm guessing the LWC infrastructure will automatically select an appropriate format of icon based on device capabilities. However, many many thanks for your very helpful answer.
– Phil W
Jul 4 at 12:03
1
Not at all, you are welcome!
– Mariia Illarionova
Jul 4 at 12:04
Thanks for the fast reply! I'm considering whether Raul's approach will work since I want to do this inside an LWC component that then uses the lightning-icon component within it. Will let you know the direction I go.
– Phil W
Jul 4 at 11:24
Thanks for the fast reply! I'm considering whether Raul's approach will work since I want to do this inside an LWC component that then uses the lightning-icon component within it. Will let you know the direction I go.
– Phil W
Jul 4 at 11:24
2
2
What's most interesting with this is that multiple icon URLs are returned by this query - different types and sizes (one SVG and several different PNGs that seem to be different sizes). The SVG file naming seems to closely resemble the needed "category:name" format for lightning-icon names, being like ".../custom/custom57.svg" in my case. Restricting to the SVG is easy: "SELECT (SELECT ContentType, Url FROM Icons WHERE ContentType LIKE 'image/svg%') FROM TabDefinition WHERE SobjectName = 'MyCustomObject__c'"
– Phil W
Jul 4 at 11:47
What's most interesting with this is that multiple icon URLs are returned by this query - different types and sizes (one SVG and several different PNGs that seem to be different sizes). The SVG file naming seems to closely resemble the needed "category:name" format for lightning-icon names, being like ".../custom/custom57.svg" in my case. Restricting to the SVG is easy: "SELECT (SELECT ContentType, Url FROM Icons WHERE ContentType LIKE 'image/svg%') FROM TabDefinition WHERE SobjectName = 'MyCustomObject__c'"
– Phil W
Jul 4 at 11:47
I think we are likely to go with Raul's suggestion. The reason I say this is that I'm guessing the LWC infrastructure will automatically select an appropriate format of icon based on device capabilities. However, many many thanks for your very helpful answer.
– Phil W
Jul 4 at 12:03
I think we are likely to go with Raul's suggestion. The reason I say this is that I'm guessing the LWC infrastructure will automatically select an appropriate format of icon based on device capabilities. However, many many thanks for your very helpful answer.
– Phil W
Jul 4 at 12:03
1
1
Not at all, you are welcome!
– Mariia Illarionova
Jul 4 at 12:04
Not at all, you are welcome!
– Mariia Illarionova
Jul 4 at 12:04
add a comment |
Thanks for contributing an answer to Salesforce Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f268249%2fsoql-query-or-other-means-to-get-the-icon-assigned-to-an-object%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Not sure about SOQL, but you can access the
themeInfo.iconUrl
from LWClightning/uiObjectInfoApi
. For learning I had used it for porting my lookup component to lwc component (although never got chance to finish).– Raul
Jul 4 at 11:19
Oooh, thanks for that. As I said, happy to either SOQL it or access somehow from within an LWC component. I'll go have a look and come back to you.
– Phil W
Jul 4 at 11:20
1
Interestingly this led me to salesforce.stackexchange.com/questions/190454/… (searching for themeInfo iconUrl) which ties in with Mariia's description and example of the icon URL.
– Phil W
Jul 4 at 11:32
@Raul, please could you turn your comment into an answer - it's a good way of handling it in the context of LWC.
– Phil W
Jul 4 at 12:01