1

I've made a few attempts to pull an opportunity field (Bill_To_Account__c from line items. I came across this post but can't figure out the solution.

Attempt 1

SELECT Id, Forecast_Start_Date__c, Forecast_End_Date__c, Forecast_Product_Name__c, 
Name, OpportunityId, (SELECT Bill_To_Account__c FROM Opportunity)
FROM OpportunityLineItem

The error:

INVALID_TYPE:
(SELECT Bill_To_Account__c FROM Opportunity)
^

Attempt 2

SELECT Id, Forecast_Start_Date__c, Forecast_End_Date__c, Forecast_Product_Name__c, 
Name, OpportunityId, Opportunity__r.Bill_To_Account__c
FROM OpportunityLineItem

The error:

INVALID_FIELD:
Forecast_Product_Name__c, Name, OpportunityId, Opportunity__r.Bill_To_Account__c
^

1 Answer 1

2

Attempt 2 should work, but you should try Opportunity.Bill_To_Account__c instead of Opportunity__r.Bill_To_Account__c since it's not a custom relationship.

1
  • That did it! Thank you :)
    – Kermit
    Mar 1, 2021 at 20:40

You must log in to answer this question.

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