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
Siddhartha Ghosh 17Siddhartha Ghosh 17 

visualforce Apex

Hi All,

1>I have a button on a standard button  on Account detail page (on click javascript) .... which just passes the account external Id and account Id to an apex class and calls the method.(GETCALLOUT method )
2>Now this GETCALLOUT method makes a callout . the responsebody comes as '{}', which is basically NULLI want to show an error message/alert/popup or anything on the Account detail page.
so basically 

if (response.getBody() == '{}')
        {
            
            //I need to show the error message that the account is c       unavailable in the source system.
            
        }

Please help Me. I dont want to perform a DML operation on this condition. I tried to achieve this with apex:messages but there are some restrictions I am facing..

<apex:page controller="CLASS1"
<apex:pageMessages ></apex:pageMessages>
</apex:page>


global class CLASS1{
public CLASS1(){
     ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, 'First Error Message added from apex'));
        ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, 'Second Error Message added from apex'));
 // I tried with error message but the problem is I am unable to return to the constructor when I am checking the condition 
    public static HttpResponse GETCALLOUT ()
{
if (response.getBody() == '{}')
        {
            
            //I need to show the error message that the account is c       unavailable in the source system.
            
        }

}
 
}
Regards,
Siddhartha