Announcements
This site is in read only until July 22 as we migrate to a new platform; refer to this community post for more details.

Apps Script Return Value not working as expected with For Each Row In Table

My second attempt to resolve this issue. Let me simplify my question 🙂 Specifically, this example can be done in a much simpler way, but it is just for example purposes, and my other stuff can be run only through Apps Script.

Let's say I have a table "tracking_id". In this table, "tr_id" is the key and label, and "status" is a text field. Let's say I need to create a bot that takes text from "tr_id" and adds "@dev". Let's say I want to do it through Apps Script.

In my EVENT settings, I activate "For Each Row In Table" and select my table "tracking_id". For the PROCESS, I have two tasks:

1. Apps Script

function appendDev(botEvent) {
  var text = botEvent || ""; // Use the provided column value
  var result = text + "@dev";
  Logger.log(result);
  return result;
}

Screenshot 2025-02-01 at 7.59.45 AM.png

2. Set row values

Column "status" = [textscript].[Output]

Screenshot 2025-02-01 at 8.01.08 AM.png

Now I run the bot, but it always updates "status" for the last row only. And if other rows have anything in "status", the bot erases it. What am I missing?

Screenshot 2025-02-01 at 8.05.12 AM.png

Thank you!

 

 

 

 

 

 

 

0 2 371
2 REPLIES 2

You might get more details fro the automation Monitor logs.  In the "3 dot" menu in the upper right of the Bot (next to the Disable button) there should be a Monitor menu option.  Tap that and when it opens select your app on the left hand side then select the "Runs" tab on the bottom.  In the middle panel search for the Bot and see if any Bot runs had errors.  Each row is represented individually.

It would appear, based on what you have provided, that not all the rows are not being selected to run through the Bot.  Please show us the "textbot" Event step at the top and how it is configured.  Is there any criteria that filters the rows?

Thank you. I checked this monitor, but there is literally nothing that can help. I will copy/paste data about rows data02 (which was not updated) and data04 (the one that was updated).

 

 

data02

Events tab:

 

 

Name
textbot
Created TimeStamp
2/1/2025 5:00:04 PM
Data
{
  "Row ID": "qiLs5GrvVrc3ipaEihlRZ1",
  "tr_id": "data02",
  "status": "",
  "duplicate": "",
  "added_on": "02/01/2025 07:29:51",
  "uid": "257Lx2one3hQAfCGpFJ2Iu"
}

 

Process > Steps tab:

 
 

 

#
1
Name
Input
Created TimeStamp
2/1/2025 5:00:04 PM
Output data
{
  "Row ID": null,
  "tr_id": null,
  "status": null,
  "duplicate": null,
  "added_on": null,
  "uid": null,
  "Related tracking_historys": null
}

 

 

 

#
2
Name
textscript
Created TimeStamp
2/1/2025 5:00:06 PM
Output data
{
  "Row ID": null,
  "tr_id": null,
  "status": null,
  "duplicate": null,
  "added_on": null,
  "uid": null,
  "Related tracking_historys": null
}
Task Properties
{
  "Success": true,
  "ReturnValue": {
    "stringValue": "data02@dev"
  },
  "Task Type": "AppsScript",
  "Task Name": "textscript Task - 1",
  "ScriptId": "1STeIIpXekEq3FglXZQht3yvooLh-K2SRSmz1ithKwlW7lNmXZJbVyW8v",
  "FunctionName": "appendDev",
  "FunctionArguments": {
    "stringValue": "data02"
  }
}
#
3
Name
addtext
Created TimeStamp
2/1/2025 5:00:09 PM
Output data
{
  "Row ID": null,
  "tr_id": null,
  "status": null,
  "duplicate": null,
  "added_on": null,
  "uid": null,
  "Related tracking_historys": null
}
#
4
Name
Process for New Bot 2 - 1-returnStep
Created TimeStamp
2/1/2025 5:00:09 PM
Output data
{}

 

 

data04

Events tab:

 

Name
textbot
Created TimeStamp
2/1/2025 5:00:04 PM
Data
{
  "Row ID": "IqRSYXLw3wMwkIgzxeJpt9",
  "tr_id": "data04",
  "status": "data04@dev",
  "duplicate": "",
  "added_on": "02/01/2025 07:30:03",
  "uid": "qX2wMaE33D2uEiRW5u97b4"
}

 

Process > Steps tab:

 

#
1
Name
Input
Created TimeStamp
2/1/2025 5:00:04 PM
Output data
{
  "Row ID": null,
  "tr_id": null,
  "status": null,
  "duplicate": null,
  "added_on": null,
  "uid": null,
  "Related tracking_historys": null
}
#
2
Name
textscript
Created TimeStamp
2/1/2025 5:00:08 PM
Output data
{
  "Row ID": null,
  "tr_id": null,
  "status": null,
  "duplicate": null,
  "added_on": null,
  "uid": null,
  "Related tracking_historys": null
}
Task Properties
{
  "Success": true,
  "ReturnValue": {
    "stringValue": "data04@dev"
  },
  "Task Type": "AppsScript",
  "Task Name": "textscript Task - 1",
  "ScriptId": "1STeIIpXekEq3FglXZQht3yvooLh-K2SRSmz1ithKwlW7lNmXZJbVyW8v",
  "FunctionName": "appendDev",
  "FunctionArguments": {
    "stringValue": "data04"
  }
}
#
3
Name
addtext
Created TimeStamp
2/1/2025 5:00:09 PM
Output data
{
  "Row ID": null,
  "tr_id": null,
  "status": null,
  "duplicate": null,
  "added_on": null,
  "uid": null,
  "Related tracking_historys": null
}
#
4
Name
Process for New Bot 2 - 1-returnStep
Created TimeStamp
2/1/2025 5:00:09 PM
Output data
{}

 

Top Labels in this Space