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
OlaOla 

Lookup or Master-Detail connection from a custom object to OpportunityLineItem

Has anyone been able to associate a custom object to OpportunityLineIte?

 

I'm trying to associate a custom object (BOM_Item__c) to OpportunityLineItems, preferably via a Master-Detail connection but a Lookup connection would also be ok.

 

I've tried to do this via the salesforce web setup interface. When trying to create a Lookup or Master-Detail connection the OpportunityLineItem is not among the selectable objects.

 

When I try to create the connection via the Force.com integration in Eclipse I also get errors (see below).

Is the OpportunityLineItem not a normal object? If that's the case is there some other way I can achieve the same result?

 

Any help would be much appreciated!

 

Thanks!

/Ola

 

Custom object:

 

<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
<deploymentStatus>Deployed</deploymentStatus>
<description>Part of the Bill Of Material for the associated Opportunity Line Item</description>
<fields>
<fullName>Opportunity__c</fullName>
<label>Opportunity</label>
<referenceTo>Opportunity</referenceTo>
<relationshipLabel>BOM Items</relationshipLabel>
<relationshipName>BOM_Items</relationshipName>
<relationshipOrder>0</relationshipOrder>
<type>MasterDetail</type>
<writeRequiresMasterRead>true</writeRequiresMasterRead>
</fields>
<fields>
<fullName>OpportunityLineItem__c</fullName>
<label>BOM OpportunityLineItem</label>
<referenceTo>OpportunityLineItem</referenceTo>
<relationshipLabel>Line Item BOM Item</relationshipLabel>
<relationshipName>Line_Item_BOM_Item</relationshipName>
<type>Lookup</type>
</fields>
<label>BOM Item</label>
<listViews>
<fullName>All</fullName>
<filterScope>Everything</filterScope>
<label>All</label>
</listViews>
<nameField>
<label>BOM Item Name</label>
<type>Text</type>
</nameField>
<pluralLabel>BOM Items</pluralLabel>
<searchLayouts/>
<sharingModel>ControlledByParent</sharingModel>
</CustomObject>

 

 

 

 

Deploy error:

# Deploy Results:
   File Name:    objects/BOM_Item__c.object
   Full Name:  BOM_Item__c.OpportunityLineItem__c
   Action:  NO ACTION
   Result:  FAILED
   Problem: Custom Object Definition ID: bad value for restricted picklist field: OpportunityLineItem

debwellerdebweller

Ola, were you able to get this working?  I just came across this post and amy looking to do something similar for config-to-order BOMs.

Thanks

-dweller

kevjaykevjay

I also need this.  Anyone figure out a solution?