We have a custom object Inventory that is created by the addition of a product to an Opportunity.
On the Opportunity there can be one or more products that will ship together. When a Product is added to the Opportunity in the Opportunity line item section the Apex Trigger creates an Inventory Item with a Credit of the Quantity for each product on the Opp. Inventory records are added (Debit) when product is shipped to the Distributor and a report reflects the difference between credits (each shipment detail) and debits (additions to inventory) so that we have a running total of Inventory at the Distributor.
Now we have two distributors, and the knowledge of which distributor will ship the product is not known until after the Inventory records are created. As it is today, when a product is modified or deleted the associated inventory record is updated or deleted.
The Distributor can be determined by a custom status field on the Opportunity. So I am added a Distributor field to the Opportunity, and set a workflow rule to populate that value. Then I set a formula field on the Inventory record that is related to that Opportunity.
The Problem is that a Debit Inventory record, The Addition of product at the distributor, is not tied to an Opportunity, and with the Inventory.Distributor__c field being a formula field can't be edited.
The current workaround is to have a second Inventory.SendToDistributor__C field that is a picklist that is poplulated for supply shipments (Debits). But I would rather automate via lookup or Work Flow or Trigger.
Thank You, Kelly