Related data bulk creation

Hey everyone,

I’m trying to implement carousel’s on the frontend of my application, and controlled through Forest Admin but can’t seem to make it work correctly.

Expected behavior

Basically, I have a Carousel model and a CarouselPhotos model. I have created a hasMany relationship on the Carousel model to the CarouselPhotos model.

This means that I have the related data section on carousel data:

I want to be able to add multiple images at once, without having to add image by image (time consuming). So I was wondering if there was a way to add an action? to the plus button on the right hand side:

From which it would be possible to add multiple images at once ? Thus, creating a smart action enabling us to create multiple entries at once.

Actual behavior

Only adding image by image.

Thanks

Hello @daweido,

It looks like your requirement can be achieved thanks to a smart action :smiley:

Did you already take a look at this feature?

Let me know :slight_smile:

Hello @Guillaume_Cisco,

Thanks for your reply.

I actually already checked out Smart Actions but I can’t figure out how to add a smart action on related data.

Do you by any chance know how to do that?

Thanks!

Thank you for this information @daweido.

Couldn’t you directly add the smart action on your carousel collection?
This way, you would be able to select a record in your carousel list, then click on an action entitled “add photos”.

Would that be a solution for your need?

Thank you for your solution proposition @Guillaume_Cisco.

This could indeed be a solution, but wouldn’t that mean that the carousel HAS to be created before adding photos to it? Meaning that it would not be possible to add the photos and create the carousel in one shot?

Thanks

This is exact @daweido!

You will have to create the carousel then add photos to it. Only “single” smart action work with forms.
The only way I can see for you to directly create a carousel and its pertained photos is to move this business code in a smart action on another collection. with a form.

Is your carousel related to any other table in your database?

Thanks for the precisions @Guillaume_Cisco.

My carousel is indeed related to another table, other than the carouselPhotos model.

Do you think it would be possible to create a smart action to create a carousel and add photos directly?

Thanks

Yes!

I think it can be done thanks to the form included in the smart action feature :slight_smile:

You will be able to directly attach a carousel with its photos to a record of your other collection :slight_smile:

Great! Thank you very much @Guillaume_Cisco.

I will let you know if it works!

1 Like

Hey @daweido,

Did you make it work ?

Hey @vince,

Haven’t tried yet, we have decided not to include it for the moment in our project.

Thank you.