3

I can retrieve Opportunity field metadata, including picklist values, with the REST API like so:

[{"active"=>true, "defaultValue"=>false, "label"=>"Prospecting", "validFor"=>nil, "value"=>"Prospecting"},
 {"active"=>true, "defaultValue"=>false, "label"=>"Qualification", "validFor"=>nil, "value"=>"Qualification"},
 {"active"=>true, "defaultValue"=>false, "label"=>"Needs Analysis", "validFor"=>nil, "value"=>"Needs Analysis"},
 {"active"=>true, "defaultValue"=>false, "label"=>"Value Proposition", "validFor"=>nil, "value"=>"Value Proposition"},
 {"active"=>true, "defaultValue"=>false, "label"=>"Id. Decision Makers", "validFor"=>nil, "value"=>"Id. Decision Makers"},
 {"active"=>true, "defaultValue"=>false, "label"=>"Perception Analysis", "validFor"=>nil, "value"=>"Perception Analysis"},
 {"active"=>true, "defaultValue"=>false, "label"=>"Proposal/Price Quote", "validFor"=>nil, "value"=>"Proposal/Price Quote"},
 {"active"=>true, "defaultValue"=>false, "label"=>"Negotiation/Review", "validFor"=>nil, "value"=>"Negotiation/Review"},
 {"active"=>true, "defaultValue"=>false, "label"=>"Closed Won", "validFor"=>nil, "value"=>"Closed Won"},
 {"active"=>true, "defaultValue"=>false, "label"=>"Closed Lost", "validFor"=>nil, "value"=>"Closed Lost"}]

But I can't seem to find a way to retrieve the "Type" metadata associated with each picklist value that you can see with the web interface:

screenshot

Is there any way to get that "Type" metadata using the REST API?

1 Answer 1

3

This is actually data, not metadata, and you can query for it in the OpportunityStage object.

SELECT IsActive, IsClosed, IsWon FROM OpportunityStage

The Type field itself is not stored, but can be inferred from the IsClosed and IsWon fields. If IsClosed is false, the Type is Open. If IsClosed is true and IsWon is false, the Type is Closed/Lost. If IsClosed is true and IsWon is true, the Type is Closed/Won.

1
  • This is not related to the OP, however I felt it might be worth noting if you wanted to query the Opportunity and get the StageName's "Type", you can infer it from these values: ---> SELECT Name, IsWon, IsClosed FROM Opportunity LIMIT 1 Dec 17, 2020 at 20:06

You must log in to answer this question.

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