Refresh sub-panel values when another sub-panel is updated

Scenario:

New record is added to sub-panel (A) which triggers a logic hook which updates 2 other sub-panels. Problem is that to see the changes we need to reload the page.

I know we can put custom JS which will ā€œlistenā€ to sub-panel changes and when a change takes place it will update other sub-panels, but Iā€™m not sure how to implement it.

Thereā€™s an example here: https://community.sugarcrm.com/thread/32308-how-can-i-refresh-a-specific-subpanel-in-the-detailview but Iā€™m not JS savvy enough yet to understand how to implement it

May be someone has an example sitting on their hard-drive somewhere?

Thank you!

Finally found a solutionā€¦

To summarize for those reading, you need to create a custom controller in

custom/modules/PARENT_MODULE/controller.php

When you change something in your sub-panel it will generate a new $_REQUEST (in real-time) so when youā€™re satisfied that the right sub-panel is being manipulated you can fire the showSubpanel(ā€˜FIELD_NAMEā€™,null,true); action.

Hereā€™s a video that explains it:
https://youtu.be/wqLAIp52CIA

2 Likes

Thanks Robert! This is very useful, we need more tutorials like this!

1 Like

Will definitely make more of them, glad you liked it!