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
mustapha laouari 15mustapha laouari 15 

OSQL relationship between Sobjects...

Hello Everybody,

I m looking for some assistance please.
im running a basic Osql query : 
public List<Quote> getclosedwonlist() {
  		return [SELECT Id, Quote.Name, Opportunity.status FROM Quote WHERE Opportunity.status='Closed Won' ORDER BY Id];
	}
Even there is a relationship between Quote and Opportunity, system return the following error :

No such column 'status' 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.

By advance thank you
Best Answer chosen by mustapha laouari 15
Jayanth ThathapudiJayanth Thathapudi
Hi

I think you are refferring to custom feild. So use '__c' at end of the feild in the query.

public List<Quote> getclosedwonlist() {
          return [SELECT Id, Quote.Name, Opportunity.status__c FROM Quote WHERE Opportunity.status__C='Closed Won' ORDER BY Id];
    }
Regards
Jay

All Answers

Jayanth ThathapudiJayanth Thathapudi
Hi

I think you are refferring to custom feild. So use '__c' at end of the feild in the query.

public List<Quote> getclosedwonlist() {
          return [SELECT Id, Quote.Name, Opportunity.status__c FROM Quote WHERE Opportunity.status__C='Closed Won' ORDER BY Id];
    }
Regards
Jay
This was selected as the best answer
mustapha laouari 15mustapha laouari 15
Hi, 
Many thanks for answer, that's what happen when working too long time, i did mix between the 'status' field whi is standard in Quote and the one in Opportunity which is 'stageName'...shame.
Many thanks :-)