Hello,
I have an AppSheet app with the following table schema:
1 Parent Table:
- Multiple Children tables referencing the "Parent" table
- There is 1 special "child (sub parent)" table referencing the "Parent" table with multiple children tables referencing the "child (sub parent)" table
I have an App Script function called createTemplate(row) that creates PDF letters when a record is created. When a record is created in the "Parent" table it always needs to have at least one child record created as well.
The App Script function createTemplate(row) works fine when I manually run the function through App Script by passing a "Parent" table row number as an argument. However, when I create a bot in AppSheet calling the createTemplate(row) function when a record is created in the "Parent" table, it always fails. What I have observed is that the createTemplate() functions runs right after a "Parent" record is created, but before the children records are created, thus leading to the failure. That 20 to 30 second delay between the creation of the parent record, and the creation of child record is the issue.
As a potential solution, I even injected a wait step with wait for "A period time" of 5 minutes in the AppSheet bot prior to createTemplate function event being trigged. However, the createTemplate function is still failing, or the bot times out. The rare occasion when the bot does work, it takes around 30 to 45 minutes to trigger the createTemplate function through AppSheet which is baffling me.
I even tried utilizing the sleep method in App Script, but what happens then is, AppSheet waits until the sleep method has expired before creating the children records. Then the same issue as above occurs.
I already have a workaround to make this function trigger properly right in App Script, but it is inefficient. Therefore, I would really like to make the function work directly through AppSheet when a parent/children records are created. How do I do that? Given there are ~20 different child tables, I don't want to check each child table for a new record before firing the createTemplate() event in AppSheet.
Any advice and/or suggestions would be greatly appreciated. Thank you.
User | Count |
---|---|
25 | |
15 | |
4 | |
3 | |
3 |