I have a requirement of showing a pop up (soft error) that will show a message when account information is not filled in the page. This is a salesforce standard page and hence there is no VF code written. I wrote the below inline VF and inserted it in the page layout but it is not showing the alert message. Could you kindly advice if anything is wrong ?

<apex:page standardController="Event_Cost__c" rendered="{!Event_Cost__c.Account__c == ' '}">
    <script type="text/javascript">
        { window.alert("You have not selected Account"); }
  • Try rendered="{! ISBLANK(Event_Cost__c.Account__c) }"; your present code seems to be checking to see if the value is a single character string containing a space.
    – Keith C
    Aug 8, 2014 at 8:59

2 Answers 2


Here's a different approach altogether to use that requires no code

  1. Create a custom formula field called 'Alerts'
  2. Add to a section with 1 column - and don't display header on edit or view
  3. Use the following formula pattern (done on an Opportunity)

The example will display a little red/yellow/green flag plus text whenever either field Foo__c is empty/'TBD' or the parent Account is missing the market/geo/region/billingCountry.

The approach has limitations in that the formula field can't be more than 5000 characters compiled but for a limited set of soft alerts, it works great and can be customized point-and-click

    /* Form of an alert is a set of concatenated strings as follows:

    IF(<condition 1>,
       IMAGE("/img/samples/flag_yellow|red|green.gif" , 'Yellow|Red|Green' ,12,12) & ' alert text with leading space' & BR() ,
    ) &
    next condition as above for second alert */

    IF (OR(ISPICKVAL( Foo__c,"TBD"),ISPICKVAL(Foo__c,"")),
        IMAGE("/img/samples/flag_yellow.gif" , 'Yellow' ,12,12) & ' Foo is not set to Yes or No' & BR(),
    IF (OR(ISPICKVAL( Account.Geo__c, ""),
           ISPICKVAL( Account.Region__c , ""), 
       IMAGE("/img/samples/flag_red.gif" , 'Red' ,12,12) & ' One or more of Account Geo/Region/Country/Market is blank. Update on the Account tab. Required for reporting' & BR(),

Here's an example (redacted) from one of my standard page layouts

enter image description here


I don't think you have direct access to the fields on the standard page. Try adding the fields as hidden input. Something like this, would pop up whenever the record is viewed and saved:

<apex:page standardController="Event_Cost__c" tabStyle="Event_Cost__c" >
  <apex:form >
    <apex:inputHidden value="{!Event_Cost__c.Account__c}" id="account"/>
  <script language="javascript">
     var acct;
     window.onload = function() {
       if (acct.length===0) {
         alert("Warning, the record was saved without an Account!");

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .