How to trigger an action from another action?
I have an infolist which displays a record. It has two header actions. 'Edit report' and 'Enhance with AI'.
'Edit report' opens a form which allows a user to edit the record and save.
When 'Enhance with AI' is clicked, I want it to open a form modal with takes some instructions which is used to improve the report(which is sent to chatGPT), I then want to open the 'Edit report' action modal and insert the enhanced report into it which the user can review and submit.
How do I trigger the 'Edit report' action from 'Enhance with AI' action?
Thanks
4 Replies
Anyone has any ideas?
$this->mountAction('edit-report', ['report' => $report->id]);
I'm able to get this working when defining an action separately in a function like:
But it's not working for actions defined in headerActions() of the infoList. The prevous action closes. Nothing else happens.
I also found a method called
mountInfolistAction()
in InteractsWithInfolists
trait. But calling this just shows the dark background which usually shows behind the modal. But it doesn't show the modal itself (with the form).
What could be the reason?Idk about that but How I got this working was registering actions with getActions method
The thing is to mount the desired action when something happens.