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;








1















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?










share|improve this question



















  • 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












  • 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















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?










share|improve this question



















  • 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












  • 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








1








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?










share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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 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






  • 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





    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






  • 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










2 Answers
2






active

oldest

votes


















2














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.






share|improve this answer






























    3














    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.






    share|improve this answer























    • 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













    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
    );



    );













    draft saved

    draft discarded


















    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









    2














    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.






    share|improve this answer



























      2














      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.






      share|improve this answer

























        2












        2








        2







        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.






        share|improve this answer













        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.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jul 4 at 12:14









        RaulRaul

        13.1k3 gold badges19 silver badges42 bronze badges




        13.1k3 gold badges19 silver badges42 bronze badges























            3














            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.






            share|improve this answer























            • 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















            3














            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.






            share|improve this answer























            • 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













            3












            3








            3







            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.






            share|improve this answer













            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.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            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

















            • 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

















            draft saved

            draft discarded
















































            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.




            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            Get product attribute by attribute group code in magento 2get product attribute by product attribute group in magento 2Magento 2 Log Bundle Product Data in List Page?How to get all product attribute of a attribute group of Default attribute set?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 : Get Product Attribute values By GroupMagento 2 How to get all existing values for one attributeMagento 2 get custom attribute of a single product inside a pluginMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Magento2: how to develop rest API to get new productsGet product attribute by attribute group code ( [attribute_group_code] ) in magento 2

            Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

            Magento 2.3: How do i solve this, Not registered handle, on custom form?How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 : File Upload issue in UI Component FormMagento2 Not registered handleHow to configured Form Builder Js in my custom magento 2.3.0 module?Magento 2.3. How to create image upload field in an admin form