2

I want to display an icon in a formula field based on the value in another checkbox field on my object. I would like to use the standard Lightning SLDS icons here. I've found a way to achieve this using static resources.

I downloaded the icon I needed from https://www.lightningdesignsystem.com/downloads/ and uploaded it as a static resource. The formula markup is as follows and works correctly to display the icon when the checkbox is true, and display nothing if the checkbox is false:

IF(MyCheckbox__c, 
    IMAGE(
        LEFT(
            $Api.Partner_Server_URL_260,
            FIND('/services',$Api.Partner_Server_URL_260)
        )
        +
        "resource/MyIconResource",
        "MyIconResource",
        25,
        25)
    ,
    ''
)

My question is, is there any way to access the standard SLDS Lightning icons in a formula field without having to using static resources, perhaps by accessing a URL for an icon directly from the formula?

Similar (and unanswered) question here: https://developer.salesforce.com/forums/?id=9060G000000UVR4QAO

Thanks!

  • I do not think you can do this. For a custom lightning component (from here) - you should use svg url: /_slds/icons/utility-sprite/svg/symbols.svg?cache=9.18.0#refresh for the refresh utility icon or /_slds/icons/standard-sprite/svg/symbols.svg?cache=9.18.0#task2 for the standard task icon. To use it like a standard record page - you can use the standard url, for example the opportunity: /img/icon/t4v35/standard/opportunity_120.png, but this is a transparent png and to show it with colors you need more than the image (background etc.). – Itai Shmida Sep 13 '18 at 7:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.