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
MaverickDevMaverickDev 

Can not access custom picklist field using REST API query used in formula field

Hi,


Here is the scenario,

I've created custom field named as Status__c, which is a picklist with values Hot, High, low and I've another formula field (status_icon__c) which shows images accordingly. 

E.g..

IMAGE(CASE( Status__c,
"Hot", LEFT($Api.Enterprise_Server_URL_260, FIND( "/services", $Api.Enterprise_Server_URL_260) -1) +"/resource/hot" , ... etc..,
"/s.gif"), "Priority Flag")

 

So, I'm using value from pick list in formula field to show images respectively to user. But when I'm trying to access picklist field using REST api query, it always says "400 Bad request".

e.g. ..query?q=SELECT Id, Email, Status__c FROM Lead WHERE Email = xxx@xxx.com

Coz it does not allow rest API to access this field. ?

When I use sobject/describe, it does not show Status__c as field belongs to Lead section but it does shows under "status_icon__c" field with respective formula.

 

So, here are my points I need suggestion about;

1. How to access and update picklist which is used in formula field using REST API.

2. If point 1 is not possible, how to update formula field using REST API.

 

I do not want to write code in APEX, as I want to write this in my project (.NET)

 

Please, let me know if anyone has resolution for this.

 

Thanks!!

SuperfellSuperfell

What does the body of the response say when you get the 400 error? are you URL encoding your query ?

MaverickDevMaverickDev

Yes, I'm encoding URL.

It simply says 400 Bad Request but If I replace Status__c (picklist) name with status_icon__c (formula field), it works.

 

SuperfellSuperfell

There'll be a response body as well with the 400 error that has more info. You'll need to look at that.

MaverickDevMaverickDev

It says;

[ {
  "message" : "\nSELECT Id, Email, status__c FROM\n                  ^\nERROR at Row:1:Column:19\nNo such column 'Status__c' on entity 'Lead'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.",
  "errorCode" : "INVALID_FIELD"
} ]

 

But above field exists in my lead section! What needs to be done?