cancel
Showing results for 
Search instead for 
Did you mean: 

NumberFormat in CPQ REST-API

Former Member
419

Dear community,

while connecting a custom application to CPQ using the REST-API I figured out that I need to observe the user's individual numberformat (especially: decimal separator) when sending (POST) values to CPQ. This means that when I want to send 1234.56 while logged in as a users with EU numberformat, I litereally have to send it as a string "1234,56". Is this a bug or a feature?

If it's a feature, how can I (with the help of the API) figure out the current setting of the logged on user?

I found the endpoint "GET /setup/api/v1/admin/users/{id}" but this obviously fails for non-admin users. Then there's "GET /api/rd/v1/UserPersonalization/GetInitData" which shows me all available numberformats, but not the one chosen by the user.

Can you help me?

Accepted Solutions (0)

Answers (2)

Answers (2)

Fancy_Zou
Product and Topic Expert
Product and Topic Expert

Hi moritz.geisberger ,

I suppose there are two approaches to resolving the problem:

  1. If you are interaction with CPQ in external systems, it is recommended to use a unified communication user of CPQ for the API calls. By that way, the formats of a certain data type used in the API interaction can be known.
  2. If you are invoking the API within CPQ via IronPython scripting or via UI Responsive Template, CPQ provides the code snippet for programmer to transform the data value to either the user's personalized format, such as UserPersonalizationHelper.ToUserFormat() in IronPython.

Best Regards

Fancy

yogananda
Product and Topic Expert
Product and Topic Expert
0 Kudos

moritz.geisberger

If you want to extract some information from API, then for Number format - Go to General Application Parameters to keep it in default format.

Former Member
0 Kudos

Dear Yoga, thanks for your reply! What a surprise that my consultant from June is answering this question 🙂

Unfortunately I do not really get your answer - maybe I have to explain my issue with more detail:

Let's assume the "Default Number Format" is set to "1,234.56" as in your picture, but for my individual user account I changed it to "1.234,56". Now I have added a QuoteTable with a numeric column (let's call it "TestColumn"). When I want to add data to it via the API (POST /api/v1/quotes/{{QuoteID}}/quoteTables/LHT_Opportunity_Sync/rows), I use the following payload:

{"ColumnName": "TestColumn", "Value": 1234.56}

However, when I now open the quote and the my QuoteTable it shows 123.456,00 instead When I want to achieve the correct result (1.234,56) I have to use the following payload:

{"ColumnName": "TestColumn", "Value": "1234,56"} 

I believe this is a bug, as the API should expect numbers as numbers and not as strings. If this behavious is intended, I need a way to read the user setting via the API.


Thanks again and best regards,

Moritz