0

I'm currently experimenting with creating a new Apex page from API. I'm using the API Explorer as this is the fastest for me.

{
  "Name": "Test Page",
  "Markup": "<apex:page standardController=\"Lead\"><apex:outputPanel layout=\"block\" style=\"font-weight:bold\">Test Page</apex:outputPanel></apex:page>",
  "ApiVersion": 39,
  "Description": "This is a test page",
  "MasterLabel": "Test Page",
  "ControllerKey": "Lead",
  "ControllerType": "Standard"
}

I'm trying to POST this to the /services/data/v39.0/sobjects/ApexPage endpoint, and I'm receiving the following 400 response:

[
  {
    "message": "Controller Type: bad value for restricted picklist field: Standard",
    "errorCode": "INVALID_OR_NULL_FOR_RESTRICTED_PICKLIST",
    "fields": [
      "ControllerType"
    ]
  }
]

According to the documentation here the ControllerType I'm supplying is right as I'm trying to tie this page to a standard sObject (Lead) but I might get it totally wrong.

Would you please help me out with this one?

2 Answers 2

1

This is working with following response.

{
  "Name": "TestPage1",
  "Markup": "<apex:page standardController=\"Lead\"><apex:outputPanel layout=\"block\" style=\"font-weight:bold\">Test Page</apex:outputPanel></apex:page>",
  "ApiVersion": 41,
  "Description": "This is a test page",
  "MasterLabel": "Test Page",
  "ControllerKey": "Lead"
}

Remove the "ControllerType": "standardController" and one more thing page name should only contain alpha-numeric characters &/or underscore.

2
  • Thanks, for some reason I thought that the ControllerType is a mandatory parameter. Is there a way to figure out (using the API Explorer or documentation) which parameters are required and which are not? Jan 18, 2018 at 8:36
  • yes, we need some more information on documentation.I did trial-and-error. I noticed for name it is mentioned as "Required". Link: developer.salesforce.com/docs/atlas.en-us.api.meta/api/…
    – Ysr Shk
    Jan 18, 2018 at 10:50
0

I guess there is a typo in their docs there then, have you tried sending

"ControllerType": "standard"

Or

"ControllerType": "standardController"

I tried to test this myself but the API explorer won't accept my developer sandbox at all.

This site is temporarily in read-only mode and not accepting new answers.

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