Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

I am trying to create a custom Formula field on the OrderProduct standard object that is new with the Spring 14 release. However, while the standard fields ListPrice & UnitPrice are available in the merge field drop down on the formula editor, the standard TotalPrice field is not. From what I can tell, the field level security for TotalPrice is the same as that of the ListPrice field yet ListPrice is available in the drop down.

All three fields are Currency fields and the Formula field I am trying to create returns a Currency value.

share|improve this question
1  
For what it is worth, since I couldn't figure it out for you, I tried to reach out to the #askforce community as well - twitter.com/jessealtman/status/456460973776203776 –  Jesse Altman Apr 16 at 15:56
    
Thanks Jesse. I did submit a case just to have salesforce take a look at this. –  Sean Russell Apr 16 at 17:38
1  
I did get a response from Salesforce regarding the case that I entered. They did some research and referred me back to this Stack exchange post in the hopes that it would help. LOL. –  Sean Russell Apr 17 at 12:00
    
Hahaha! That is hilarious Sean! Well, did you help yourself or what? –  Jesse Altman Apr 17 at 12:11
    
All comments here helped in deciding to use the workaround of UnitPrice * Quantity but the question still remains why TotalPrice cannot be used. –  Sean Russell Apr 17 at 15:43

4 Answers 4

I took a look and couldn't see it either. I did a bit of research in the Spring '14 release notes and nothing there referenced why a field like that wouldn't be available. TotalPrice appears to be a formula itself, combining Quantity x UnitPrice. Interestingly enough, there appears to be two sets of documentation available for OrderItem as well (http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_orderitem.htm & http://www.salesforce.com/us/developer/docs/officetoolkit/Content/sforce_api_objects_orderitem.htm), neither of which have TotalPrice listed as a field. EDIT: Peter Knolle did find it in Salesforce Help

At this point, my guess is that this is some sort of bug. I looked at their open/known issues related to order and didn't see anything. My suggestion would be to open up a case and see what Salesforce says. There may be something weird about TotalPrice that isn't obvious that is preventing it from being listed. Unfortunately, there isn't a ton of documentation surrounding it just yet.

share|improve this answer
1  
I see it defined in the Salesforce Help for Order Product. –  Peter Knolle Apr 16 at 17:17
1  
Good find @PeterKnolle. According to the description, TotalPrice kind of works as I guessed: Quantity of the order product multiplied by the unit price. –  Jesse Altman Apr 16 at 17:23

I've been working with the new Order and Order Product (or OrderItem) objects, and I've noticed some inconsistencies.

My process was to use Workbench (workbench.developerforce.com/login.php) to explore the fields that actually reside on these objects (particularly OrderItem), because the fields that show in the 'customize object' subsection of Setup don't appear to be totally accurate.

I got several errors referencing fields that were appearing in the 'fields' listing from Apex. I'm not sure what's happening on SFDC's side, but it looks like Workbench has the most up-to-date field listing.

EDIT:

For whatever reason, several Order and OrderItem fields default to 'not visible' so they won't appear on Workbench when they're on the fields listing. The fields need to be individually whitelisted at the profile level (why?!).

See: http://i62.tinypic.com/24zlppw.png

share|improve this answer
    
Thanks David, I did use Workbench to confirm that the TotalPrice field was not listed on the OrderItem object. –  Sean Russell Apr 16 at 17:43
    
I can't access the OrderItem TotalPrice field in Apex and don't see it in Workbench. I do see it on the field listing on the Object definition page, and it is on the page layout, and I can see it on the detail page of a record. Just opened a support case 10522931. –  Peter Knolle May 7 at 15:56
up vote 3 down vote accepted

Salesforce has gotten back to me regarding this issue. They are reporting this as a known issue. The details of this issue are below and the link to the issuse is: https://success.salesforce.com/issues_view?id=a1p30000000T3UnAAK

Field Updates on Custom Currency Fields using OpportunityProducts.TotalPrice in Formula not Triggered as Expected

Workflow

Last updated 28 days ago ·Reference W-1060096 ·Reported By 0 users
IN REVIEW

Summary
When multiple workflow Field Updates exist on the Opportunity Products object that reference the "Total Price" field, some updates may be skipped.

Repro
1. Create a custom Currency field on Opportunity Products. 
2. Create a workflow Field Update that updates the custom field to a constant value, such as 55. 
3. Create a second Field Update that updates the custom field using a formula that returns the value of OpportunityProduct.TotalPrice.

Workaround
The current workaround is to replace the reference to the "TotalPrice" field with its calculation: "UnitPrice * Quantity".

Just received confirmation from Salesforce that:

The "TotalPrice" field is calculated dynamically via the UI and only exists when the UI displays the product records. Hence it can't be used in formula fields or other areas (like workflow). This calculation is not exposed at the API or Apex level. The "TotalPrice" is the units*price so that should be used in place of "TotalPrice".

share|improve this answer

I guess to answer your question: Instead of making a formula field that references TotalPrice, just make it reference Quantity * UnitPrice.

share|improve this answer
1  
That does appear to be the workaround at this time. –  Sean Russell Apr 16 at 18:20
    
Great! If that helps, please mark the question as answered. –  DavidSchach Apr 16 at 18:21
    
That's a good workaround! It still doesn't exactly explain why it wouldn't be available for use in a formula. I found this knowledgebase article‌​, but it still seems like it should be available in a formula as formulas are evaluated on reads. –  Peter Knolle Apr 16 at 18:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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