Inline Scripting - Minus one record from another
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2023 05:27 PM
Hi there,
I've created a "Consume Asset" flow in flow designer. It reads from a record producer where you say what consumable you will be checking out and how many of it.
I'm trying to update the consumable record so that it gets the current consumable quantity and takes away the number inputted from it to set the current quantity.
The problem is, when using an inline script it will not let me subtract one data pill from another.
What I would like to do:
var quantity = fd_data._6__look_up_record.record.quantity ;
var takeAway = fd_data._2__get_catalog_variables.how_many_of_this_item_are_being_deployed;
return quantity - takeAway;
But this errors out removes the code every time I try to save my flow.
I know that the logic is correct because if I do:
var takeAway = fd_data._2__get_catalog_variables.how_many_of_this_item_are_being_deployed;
return takeAway - 2;
or
var quantity = fd_data._6__look_up_record.record.quantity ;
return quantity - 3;
It will work fine. For some reason it just wont let me subtract the two variables form each other.
For context, quantity is an int and takeAway is a string.
Any help here would be great!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2023 08:58 AM
Also tried a for loop and it generally just seems to be that every time you reference a second piece of data, it stops working.
var quantity = fd_data._2__get_catalog_variables.how_many_of_this_item_are_being_deployed;
for (let i = 0; i < fd_data._2__get_catalog_variables.how_many_of_this_item_are_being_deployed; i++)
{
quantity - 1;
}
return quantity;