shows the message(Close date is near) on opportunity when a particular opportunity's close date is 5 days ahead

2 Answers 2


In addition to the Lightning Experience suggestion from @Raspi, for Salesforce Classic, you can simply create an image formula field that looks like this:

IF (TODAY() + 5 = CloseDate,
  IMAGE("/img/samples/flag_yellow.gif" , 'Yellow' ,12,12) & ' Close Date is imminent. Do something!' & BR(),

and place the formula field on the page layout, perhaps in an untitled section at the top. I use this technique to display 'soft alerts' that appear only when viewing a record. You can have many image expressions within one formula field.


Do you need it in the current Record Page as 'advise' ?

I usually use a Lightning component with some rules, using TOAST advises. An invisible Lightning component that handler the INIT and if some rules are true, then i call 'showToast' function:

showToast : function(component, event, helper) {
var toastEvent = $A.get("e.force:showToast");
    "title": "Close Date is near!",
    "message": "The Close date is 5 days ahead!",
    "type": "warning",
    "mode": "pester"

See documentation here: Lightning Component Show Toast

IMPORTANT! : Just for Lightning Experience Layout. If do you need for Salesforce Classic, you must build a Visualforce Page with an 'alert()'.

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.