Flow Designer - Script to increment field value

santuraj12
Tera Contributor

Hi Experts,

Need your inputs:

Trying to increment a integer value through flow. screenshot below

i could see trigger and update action being executed, but no update in field value defined. is this correct syntax? 

find_real_file.png

2 REPLIES 2

Sam Dey1
Kilo Guru

Hi santuraj12,

 

You syntax needs some slight change

var x = parseInt(fd_data.trigger.current.u_my_count);

//x++; //This is when you want to increment by 1. in that case you dont need to use the parseInt to parse the fd_data.trigger.current.u_my_count

x += 2; // this is when you want to incrtement with anumber other than one, in this case you need to use parseInt to parse the fd_data.trigger.current.u_my_count

return x;

 

Cheers,

Sam

 

Mark helpful/correct if this helps you 🙂

Robin19
Kilo Contributor

Hi Sam,

 

Can you help me? I want to increase a value by one and then multiple the value by another integer value on that same record. Here is what I have, but it isn't returning the expected values:

 

var x = fd_data.trigger.current.package.item_2.in_storage;

var y = fd_data.trigger.current.package.item_2.serving;

((x--)*y);

return x;
 
In the end, I had to parse integer and return the equation in a simplified form. But I finally got it to work. Thanks for your lessons.
 
var a = parseInt(fd_data.trigger.current.package.item_1.in_storage);

var b = parseInt(fd_data.trigger.current.package.item_1.serving);

return a-b;