function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SFDCExplorerSFDCExplorer 

Avoiding Hard COde Id's In Formula FIeld

I am using some custom image in formula filed from Dcouments by mentioning image file ID. Is there any way to avoid this hard code ID, So that It can work in any instance?

Thanks In Advance.
SFDCExplorerSFDCExplorer
@Amit. Thank you for your response.

I have alreayd gone through all these links. No link is giving information about how we can use the images in Documents witho out using their ID's.

Any Suggestion for this.
Vivek DVivek D
Hi
I guess there is not way to add the document to formula field with excaping the Id.
But the alternate way will be if you use static resource. Store your image in static resource and with just name of your static resource you can include it into formula field. 
For example your static resource name is "TestImage" in Forumula image url you can add IMAGE("/resource/TestImage" ...)
SFDCExplorerSFDCExplorer
@Vivek D. Thank you so much for your response.

Let's say If I store the image in a static resource in QA, Can i use the same in all instances like SIT, Prod ect. I want the image to be at one common place and to be used anyware. I do not want to change the formula for each instance and there should be no change in formula when I refresh my sandbox.

Thanks In Advance.
Vivek DVivek D
Yes, You can but you need to add the same static resource in each instance you don't have to change the formula. 
If you add the image in PROD env then it will be avialable in all sandbox after refresh or on create. 
SFDCExplorerSFDCExplorer
@vivek

I have to use two images in my formula. So, Instead of creating two resources, Can we have any work around to use two images with only one resource.
Vivek DVivek D
You can put all your images into a folder zip it upload to static resource and reference in formula like
IMAGE("/resource/StaticResourceName/folderName/image.png", "MyImage")