We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

Data Stream Action Output Decimal Limitation

vmanojkumar
Tera Contributor

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.

1 REPLY 1

Tanushree Maiti
Tera Patron

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.

 

Refer: https://www.servicenow.com/community/developer-forum/flow-designer-issues-with-using-if-branch-and-c...

 

 

Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti