Batch creation in Code Studio

Is there a way to create records in batch when using the cs.save() option rather than looping through an array and creating them one-by-one? I use a script that creates items based on preferences entered on the page before. Based on performance tests, each record takes 0.4 seconds to be created, what is quite time-consuming if you need to create 100 records.

Good afternoon,

Interesting post. We had a code studio solution which managed contact records for one of our yearly sign up services. It staggered contact records for 20k customers between 2 date inputs to ensure a more even distribution of pressure on our customer services team.

Like you mentioned, it took our system a long time to create such records, which wasn’t too bad for us as we didn’t have a user waiting. But we would still be interested in the solution to this.

As far as I am aware cs.save can handle saving multiple relationships to a certain object, see the multi_addition section here.

Detailed references for cs.save()

There may be a way you can use this to do what you are looking for if you can create the records as well as link them?

It could be that you have to do some of the processing whilst the input is being made to prevent a large scale operation at submission

Hopefully someone can give an insight into this method of bulk creation is possible?

Cheers,
Dan

Hi Daniel,

I’m not sure when it has been introduced, but I noticed that there now is a cs.save_multi() action, exactly what I was looking for.

Hopefully, it helps you further as well!

Kind regards,
Thijs