The CreatorCon Call for Content is officially open! Get started here.

unable to set integer value from subflow

Kumar38
Kilo Sage

I have a integer field on a table that needs to be incremented when it meets some conditions in subflow. Irrespective of what I try and logs showing integer value as expected , but runtime value under action returns 1.0,2.0 etc (I'm using update record action and trying to set field value using script). I'm testing this from test button on subflow

 

var newCount =  parseInt(fd_data.subflow_inputs.XX.yy) + 1;
var newCount2 =  parseInt(fd_data.subflow_inputs.XX.yy) + parseInt(1);
var newCount3 =  fd_data.subflow_inputs.XX.yy + 1;

 

 

1 ACCEPTED SOLUTION

Kumar38
Kilo Sage

Deleted a old field and created this and updated it under script for setting field value , but didn't update the field name

View solution in original post

3 REPLIES 3

Community Alums
Not applicable

@Kumar38 

The script seems like the field you're working with is being treated as a float or decimal (hence the 1.0, 2.0 behavior), but you're working with an integer in your logic.

Can you verify with the following Script:

e.g. var newCount = Math.floor(parseFloat(fd_data.subflow_inputs.XX.yy)) + 1;

 

Ankur Bawiskar
Tera Patron
Tera Patron

@Kumar38 

ensure your type for your subflow output variable is integer

what's the output variable type?

share screenshots.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Kumar38
Kilo Sage

Deleted a old field and created this and updated it under script for setting field value , but didn't update the field name