3

The below formula displays green red or yellow in the field based on the calculation. It works fine in classic view but not in Lightning. I read that as of Winter 15 images were not supported in formulas, but I wanted to know if there are any updates.

IF( ((Remaining_Credit__c / Account_Total_Credit__c *100) >= 41), 
IMAGE("resource/GreenBar", "green", 10, 800), 
IF( ((Remaining_Credit__c / Account_Total_Credit__c *100) >=11), 
IMAGE("resource/color_yellow.gif", "yellow", 20, 800), 
IMAGE("resource/RedBar", "red", 30, 800) 
) 
)
4

The issue is in lightning the domain value picked up has /one/resource/GreenBar and thats causing the issue not to have your image formula field rendered .

Lets work around this with a global variable in the formula for time being

IF( ((Remaining_Credit__c / Account_Total_Credit__c *100) >= 41), 
 IMAGE(LEFT($Api.Partner_Server_URL_260, FIND( '/services', $Api.Partner_Server_URL_260))+"resource/GreenBar", "green", 10, 800), 
 IF( ((Remaining_Credit__c / Account_Total_Credit__c *100) >=11), 
 IMAGE(LEFT($Api.Partner_Server_URL_260, FIND( '/services', $Api.Partner_Server_URL_260))+"resource/color_yellow.gif", "yellow", 20, 800), 
 IMAGE(LEFT($Api.Partner_Server_URL_260, FIND( '/services', $Api.Partner_Server_URL_260))+"resource/RedBar", "red", 30, 800) 
 ) 
)

Note I have dynamically appended right domain URL using a global variable $Api.Partner_Server_URL_260

| improve this answer | |
  • Thanks, It works now. Im having an issue displaying the yellow image, and the sizing is not working correctly either. However the image is being displayed and that was my main issue. Ill play with sizing and yellow and see if i can figure it out on my own. Thanks again – user8310 Sep 16 '16 at 8:37
  • Can you please explain more about what the issue was, What the fix is doing, and what the proper way of doing it is in the future? – user8310 Sep 16 '16 at 8:39
  • As explained the image URL in lightning is /one/resource/Greenbar which is not correct since correct url is /resource/Greenbar. – Mohith Shrivastava Sep 16 '16 at 9:10
  • @MohithShrivastava I am facing the similar issue and tried using your solution above, but wasn't able to resolve this. Can you please look at my post [link]salesforce.stackexchange.com/questions/184329/…? – Aman Jul 14 '17 at 16:07

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.