Is there any way I could get a query pulled of Closed-Lost opportunities, with reason lost being “competitive advantage”?

  • Is there a field that specifies the reason on your opportunity record? Closed lost opportunities can be selected by checking for StageName – navD87 May 27 '15 at 21:16
  • Yes there is a field named reason on the opportunity. – George May 27 '15 at 21:18

It would be like below,

SELECT Name FROM Opportunity
WHERE StageName = 'Closed-Lost'
AND Reason_Lost__c = 'Competitive Advantage'
  • Replace Reason_Lost__c with your reason field – Victor May 27 '15 at 21:19
  • It give me an error message. [object Object]: id, Name from Opportunity where Stage = 'Closed Lost' AND Reason_Lost__c ^ ERROR at Row:1:Column:40 No such column 'Stage' on entity 'Opportunity'. 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. – George May 27 '15 at 21:29
  • Sorry API name of stage field is stagename. Change stage = = 'Closed-Lost' to StageName = 'Closed-Lost' – Victor May 27 '15 at 21:42
  • Great..!..It worked – George May 27 '15 at 21:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.