1

I'm trying to mass create order objects with some opportunities data. I have no trouble to create those orders with the Dataloader or the developer workbench, but for some reason, the field "OpportunityId" which makes the lookup between an opportunity and an order is not available in neither data loading tool...even if I can see it in the interface, and edit it. I also tried to query the order object and check the schema on workbench, and I cannot see the field. However, in Developer Console, I'm able to query successfully : SELECT Id, OpportunityId FROM Order but not in Dataloader or Workbench, where the same query gives me the following error :

"INVALID_FIELD: SELECT Id, OpportunityId FROM Order ^ ERROR at Row:1:Column:12 No such column 'OpportunityId' on entity 'Order'. 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."

I'm an admin. I checked "Field Security Level" and Layouts. I think it might have to do with the lookup, but I don't understand. The fields are standard fields. Could it be a bug ? I'm trying to see how I can make sure that those new orders are linked to the right opportunities. Thanks in advance for any help.

2
  • i'm going to guess that your dataloader version or workbench version is less than the version when SFDC released the Order SObject - hence why you don't see it
    – cropredy
    Mar 2, 2015 at 20:08
  • well I do see the Order SObject and all it's fields. The only field I cannot access is OpportunityID for some reasons...
    – PolCls
    Mar 2, 2015 at 21:02

2 Answers 2

5

Ok, here is the issue

Field Order.OpportunityId is by default, not visible, by reason of Field Security to all profiles, including System Administrator, when Orders feature is enabled.

Update: This field, OpportunityId, was added to the schema as of Version 31 and won't be available to Workbench logins at V30 or earlier or Data Loader version V30 or below.

Go to Security Controls | Field Accessibility and change accordingly

Workbench and Data Loader use the metadata API filtered by the running user's profile to get the list of available fields.

3
  • Hi crop1645, unfortunately, I tried that already. The field "Opportunity" is visible to all users in the page layouts and editable by everyone;
    – PolCls
    Mar 3, 2015 at 10:12
  • @PolCls - I did some more testing - see update in Answer above
    – cropredy
    Mar 3, 2015 at 20:30
  • I had a related issue when attempting to use a third-party built connector that uses salesforce's SOAP API-- the URI was set to the "v29.0" and so I swapped that string out with "v31.0" and I was able to successfully insert the record!
    – GPP
    Aug 3, 2017 at 2:53
3

I faced this problem and I solved the issue.

Update the Apex class version to Version 31 or higher. This is Because this field is not available on Version 30 or lower.

you can do this by logging in to salesforce, going to Apex Class > YourClas.cls > Edit

Go to version settings and update it to the latest one (v31 or higher) then save it.

You must log in to answer this question.

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