Workflow Studio For Each Item In

markdart
Kilo Guru

Hi I based my work on this previous post- Solved: Calculate sum of flow variable within a for each l... - ServiceNow Community

 

I have an issue with the Total Sum using only one of the items in the loop. See screenshots

 

 

 

 

1 ACCEPTED SOLUTION

you are correct I checked again and move th code inside the loop and tested working now.

View solution in original post

3 REPLIES 3

Shubham_Jain
Mega Sage
// Get the current total
var currentTotal = flow.variables.totalDuration || 0;

// Add the current item's duration
var itemDuration = current.duration; // Replace with correct field reference
flow.variables.totalDuration = currentTotal + itemDuration;

✔️ If this solves your issue, please mark it as Correct.


✔️ If you found it helpful, please mark it as Helpful.



Shubham Jain


Ankur Bawiskar
Tera Patron
Tera Patron

@markdart 

then you didn't configure it well

what debugging did you do?

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

you are correct I checked again and move th code inside the loop and tested working now.