I added the following VF page

<apex:page standardController="Account" extensions="createaccount" title="Test">
    <apex:outputText value="{makePostCallout}"/>

this is my apex class

public class createaccount {
    public static HttpResponse makePostCallout() {
        Http http = new Http();
        HttpRequest request = new HttpRequest();
        request.setHeader('Content-Type', 'application/json;charset=UTF-8');
        // Set the body as a JSON object
        request.setBody('{{"system_id": "xyz"}}');
        HttpResponse response = http.send(request);
        // Parse the JSON response
        if (response.getStatusCode() != 201) {
            System.debug('The status code returned was not expected: ' +
                response.getStatusCode() + ' ' + response.getStatus());
            } else {
        return response;

in the developer console, I get the error

unknown constructor

Also When I go to create a custom button in Account object, I do not see this appearing in the drop-down list

1 Answer 1


With all changes suggested by sebastian(except outputtext to button), you need to have a constructor with standardcontroller, then only you'll be able to see VF button while creating button on object.

Like below -

public createaccount(ApexPages.StandardController stdController) {
  • 1
    I did not realize this was a standard controller. Good catch. Jul 16, 2020 at 3:36

You must log in to answer this question.

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