Data Stream Action Output Decimal Limitation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Monday
I am working on a Data Stream Action in ServiceNow to retrieve Worker Time Off Balances from Workday.
The output structure consists of an Object containing an Array of Objects, where each object represents a time off plan and includes fields such as:
- Absence_Balance
- Accrued_for_Time_Off_Plan_Year_To_Date
- Beginning_Period_Balance
- Carryover_Expiration_Balance
- Position_Based
- Time_Off_Balance_including_Pending_Events
- Time_Off_Paid_for_Time_Off_Plan_Year_To_Date etc....
These values are returned from the Workday API as decimal values (for example, 7.5, 12.25, 0.5).
However, while defining the Action Output, the properties inside the Array of Objects only allow data types such as String, Integer, Boolean, Date/Time, etc. There doesn't appear to be an option to define these properties as Decimal.
As a result, if I define these fields as Integer, the decimal precision is lost.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Monday
Hi @vmanojkumar
To handle floating-point numbers (decimal values) in a ServiceNow Flow Designer Custom Action, you need to accept a Decimal input and convert it using a Script step.
Map the decimal input as a String (rather than an Integer) using parseFloat() JavaScript function in script step. Integers will strip fractional values, but strings will preserve the exact decimal points.
Flow Designer Action inputs and outputs natively support the Decimal or Number types, but they lack a dedicated "Float" type.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti