TeamDesk Knowledge Base & Support

   Home      FAQ      Forum      Idea Exchange      Ask a Question      My Stuff      Help   
  
Best method to auto generate n children for a parent record
I have been trying to make Teamdesk generate 50 children records (instalments) for a parent record (loan), however, Workflow Triggers do not allow for any recursion.

I went through the documentation to see if I can see anything of use and the error for `Cyclic Execution of Trigger` is not mentioned once there.

I chatted with Teamdesk support and they alluded that everything is possible however they gave me the vibe that I needed to go through a paywall first before they let me in on the big secret method that Teamdesk allows for multiple record generation -- as if this was a breakthrough that they have invented. Also, with the steep pricing of Teamdesk, it's not OK to offer 0 help to paying customers.

I used the chatbot and the chatbot insisted that recursion was possible and I indulged it till the end when it finally gave up and told me to host a script file on another server that will make calls to the Api to generate these 50 entries -- which totally sucks since paying for a complete database solution with an API requires yet another external service to be able to do a basic job. There's no coding tool to help me with this from within Teamdesk.

I'm starting to think that Ms Access was the better alternative since I can do virtually anything using VBA but here I'm tied up being forced to manually do trivial task since Teamdesk is unable or unwilling to offer any help, or both.

I'm wondering if anyone in the community has ever faced a similar issue, and if so how did you get it solved.

Any help is appreciated.


ID
2104
Category
Setup
Author

Hasan Abdul Jabbar
Date Created
4/18/2025 12:30:00 PM
Date Updated
4/19/2025 2:39:32 PM
Comments
cooper collier  4/18/2025 12:37:21 PM
Hello.
Let me see if I can lend a hand.

First questions I have is will it always be 50 records?
If not, will it maybe be sets, such as sometimes 10 sometimes 25 records

Hasan Abdul Jabbar 4/18/2025 12:46:38 PM
Hello bask Cooper,

No, the 50 is just an example, actually, there is a field where the user inputs the number of instalments. It could be anything between 1 to less than a 100
cooper collier  4/18/2025 1:03:18 PM
OK, that makes it harder, TeamDesk does not support loops which does cause some challenges sometimes.

We have worked around it by creating groups of default records in a separate table that we then copy the group to our working table as needed. But this only works because the number of child records is always the same.

I cannot promise a solution, but I have some ideas.
Email me directly cooper@frobbit.com. Then we can talk back and for quicker.

It will also keep this thread cleaner, so some other experts who may have ideas and respond as well.








Hasan Abdul Jabbar 4/18/2025 1:28:11 PM
Thanks a lot for your input.

I have a workaround in mind as well which is to inject a js code that will inject a button that will perform all the necessary api calls.

I don't like this hacky option though but it seems like the only way to do it.

calvin peters 4/18/2025 2:01:40 PM
I'm pretty sure this could be accomplished using.js with dbscripts if it's a recursion that's required
The UI requires a postback to be triggered to force an update to the db if you simply need to record the output in the same record and make it persistent but the script for that is not very complicated.

The creation of new records in a table can be done with fetch() API, using the native API POST method



cooper collier  4/18/2025 2:17:39 PM
Using the javascript is not "hacky" that is why they have it so you can perform some tasks that are beyond the ability of the RAS. If I was making a system using basic MYSQL, I would be using JavaScript and PHP to do exactly the same things.

Anyway, I just tested my idea and it works fine. You may or may not like this method.

Sorry the following is rushed!! I will make a sample database in the next couple days for anyone interested.
I can show it in detail at a later date, but in short.

We make a table call it !default child!, you then have all the columns that would be in the actual child table. (you can make this table simply by copying the child table and removing the reference column to the main table.) Now you make a column called number.

So now you have TABLE!Default Child! with [number] [all the other columns] and no references.

Next you populate it with as many records as the maximum child records you would have. Just use a spreadsheet to make them fast and increment the number by 1.

Now comes the tricky part

I use the user properties for this next step. I make a hidden column for number records to copy in users
Back to your main table. Make a refernce to users, keep it hidden.
Make a number column for [number of records to copy]

make a many - many reference to the Default Child. Make it with no views

then make a recordset for the many many relation, call it records to copy, use a custom filter.
[number]<=User[test number to copy]

Now everything is ready!!

Create a Button.
set the button to ask for the [number of records to copy]
Assign User() to User Property

make an action to copy the number to copy to the User Property table Number to copy. (this makes the recordset to the defaults to have only the number of records needed)

make another action to create record source is the record set, target is the child table.
Assign each default column to the matching child table column
Assign Parentkey() to the Reference to the main table.

AFTER ALL THAT CONFUSING MESS IT WILL WORK.

I do not have the time right now.
I will try tomorrow morning to make a video and show everyone.
and make a sample database for teamdesk to post.










Hasan Abdul Jabbar 4/18/2025 3:04:32 PM
Thanks for the response.

Teamdesk just answered my question and revealed a neat unadvertised feature. You can pass a recordset directly to `Assignment` field of Create New Record action and it will iterate over it.

He built the recordset dynamically just like you did.

I hope I can also pass the recordset to a date formula to build the dates for each new child.

The catch is that a dummy table holding dummy records need to be created, but I will not make a fuss about it. If it works it works.

Thought I'd share this with you.

Thanks again Cooper.
cooper collier  4/19/2025 2:39:32 PM
yes, that is exactly how I did it.

Feedback
Back to Search Results