3

I'm trying to create a classic Invoice by using Custom Object

  • Invoice (Master)

  • Invoice Line Item (Detail)

Invoice_Line_Item should have a look up relationship with Product. Also it has to include Quantity, Total (formula) and Unit Price (the selected product standard price).

I've trying using formula and look up type for unit price. But I wasn't able to referral that Product property.

Question:

There exist any way to use Product standard price in a custom object?

2

Unit Price, unless a custom field, is not a field available on the Product object. In order to achieve what I think you are after I think you would have to revert to code either as part of a custom controller or a trigger.

I think you would need to query the PricebookEntry object:

   Select p.UnitPrice, p.Product2.Name, p.Product2.Id, p.Product2Id, 
   p.Pricebook2.IsStandard, p.Pricebook2Id From PricebookEntry p
   where p.Pricebook2.IsStandard = true
   and p.Product2Id = :someProductId

Unfortunately, you can't create a lookup directly to PricebookEntry as it's one of those 'funny' objects.

2
  • Thanks, I liked your expression "those funny objects". A trigger was my choice. – Martin Borthiry Feb 5 '13 at 15:06
  • I believe its the technical term ;) – Phil Hawthorn Feb 5 '13 at 16:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.