SAP Knowledge Base Article - Public

3234845 - CMT : CPQ - How to Get Decimal value of custom field in XSLT

Symptom

CPQ - How to Get Decimal value of custom field in XSLT

Resolution

 
Applies To:

CPQ

Summary:

This article will brief you on how to get Decimal value of custom field in XSLT

Details:

ScenarioWe need to get the decimal value instead of the display value on an XSLT to run an XSLT compare. We have a situation where we need to compare two values in an XSLT: <xsl:if test="FloorPrice != 0 and FloorPrice > NetPrice" >. It happens that NetPrice is an out of the box field and we've set the rounding to 6 digits for it but we cannot do the same for FloorPrice (a custom field). The problem is that we need an, at least, 3 digit decimal point rounding. We are thinking it twice to set the global default rounding to more than 2 digits because it is a global change, we'll affect every number display on the system.

Example: The quantity drives the price if you set it to more than 5000000 it’ll be equal to FloorPrice, in this case, the compare is not showing the FloorPrice of 0.015 but 0.02, and it appears it uses this value on the compare also because 0.02 > 0.015.

Reason: The XSLT is using values provided in XML in order to render the HTML on the page. The XML contains rounded values, so there is no way to access the value in the database (DefaultDecimal).

Solution for this situation:

1. Set the Default rounding setting to 3 or more digits (Rounding settings page in Setup). In this situation, DefaultDisplay will return expected result.
2. There would have o have one more custom field (set type as text to prevent rounding) that would have following formula as a calculation:
<*CTX( Quote.CurrentItem.CustomField(FloorPrice).DefaultDecimal )*>

Comments:

N/A

Reference:

  • SC30322857 

Keywords

KBA , CEC-SAL-CPQ , Sales Cloud CPQ , How To

Product

SAP CPQ all versions