Record Thread Widgets - Notes Bottom Widget

I followed the instructions in the link below and successfully added notes as a bottom widget to the account page:

SuiteCRM Developer Insights - Record Thread Widgets

Now, I need to achieve the same for the contracts page. I have followed the same steps, but it has not worked.

Here are a few observations that might be affecting this:

  • By default, the Contracts module has a relationship with the Notes module. However, the Contracts page does not display a Notes subpanel.
  • The Contracts page does not have any bottom widgets, whereas the Accounts page had the “Select which subpanels to view” widget. Could this mean that widgets are not enabled by default for the Contracts module?

I have modified config/services/module/recordview/sidebar_widgets.yaml (i know there is better place to do this, but while testing) so it looks like this:

parameters:
  module.recordview.sidebar_widgets:
    default:
      widgets: []
    modules:
  module.recordview.bottom_widgets:
    default:
      widgets: []
    modules:
      contracts:
        widgets: []

but this has not made a difference. To try and get the notes widget added, this is the code i am using extensions/defaultExt/config/modules/Contracts/recordview/bottom_widgets/notes.php:

<?php

namespace Symfony\Component\DependencyInjection\Loader\Configurator;

use Symfony\Component\DependencyInjection\ContainerBuilder;

return static function (ContainerBuilder $container): void {

    $bottomWidgets = $container->getParameter('module.recordview.bottom_widgets') ?? [];
    $modules = $bottomWidgets['modules'] ?? [];
    $contracts = $modules['contracts'] ?? [];
    $widgets = $contracts['widgets'] ?? [];


    $widgets[] = [
        'type' => 'record-thread',
        'labelKey' => 'LBL_NOTES',
        'allowCollapse' => true,
        'options' => [
            'recordThread' => [
                'module' => 'notes',
                'class' => '',
                'maxListHeight' => 0,
                'filters' => [
                    'parentFilters' => [
                        'id' => 'parent_id',
                    ],
                    'static' => [
                        'parent_type' => [
                            'field' => 'parent_type',
                            'operator' => '=',
                            'values' => ['Contracts']
                        ]

                    ],
                    'orderBy' => 'date_entered',
                    'sortOrder' => 'DESC',
                ],
                'item' => [
                    'itemClass' => 'pt-1 pb-1 w-100',
                    'layout' => [
                        'header' => [
                            'rows' => [
                            ],
                        ],
                        'body' => [
                            'class' => 'border bg-transparent',
                            'rows' => [
                                [
                                    'align' => 'center',
                                    'justify' => 'start',
                                    'class' => 'flex-grow-1 item-content pb-1',
                                    'cols' => [
                                        [
                                            'field' => [
                                                'name' => 'assigned_user_name',
                                                'readonly' => true
                                            ],
                                            'labelDisplay' => 'none',
                                            'modes' => ['detail'],
                                            'labelModes' => ['detail'],
                                            'hideIfEmpty' => true,
                                            'class' => 'font-weight-bold item-title pr-2'
                                        ],
                                        [
                                            'field' => [
                                                'name' => 'name',
                                            ],
                                            'labelDisplay' => 'top',
                                            'labelClass' => 'pr-1 m-0',
                                            'labelModes' => ['edit'],
                                            'class' => 'font-weight-bold flex-fill pr-1'
                                        ],
                                        [
                                            'class' => 'ml-auto',
                                            'actionSlot' => true,
                                        ],
                                    ],
                                ],
                                [
                                    'align' => 'center',
                                    'justify' => 'start',
                                    'class' => 'flex-grow-1 item-content pb-1',
                                    'cols' => [
                                        [
                                            'field' => [
                                                'name' => 'description',
                                                'readonly' => false
                                            ],
                                            'labelDisplay' => 'top',
                                            'labelModes' => ['edit'],
                                            'class' => 'flex-fill'
                                        ],
                                    ],
                                ],
                            ],
                        ],
                        'actions' => [
                            [
                                'key' => 'edit',
                                'labelKey' => 'LBL_EDIT',
                                'klass' => ['btn btn-outline-primary btn-xs'],
                                'modes' => ['detail'],
                                'acl' => [],
                            ],
                            [
                                'key' => 'cancel',
                                'labelKey' => 'LBL_CANCEL',
                                'klass' => ['btn btn-outline-primary btn-xs'],
                                'modes' => ['edit'],
                                'acl' => [],
                            ],
                            [
                                'key' => 'save',
                                'labelKey' => 'LBL_SAVE_BUTTON_LABEL',
                                'klass' => ['btn btn-outline-primary btn-xs'],
                                'modes' => ['edit'],
                                'acl' => [],
                            ],
                            [
                                'key' => 'delete',
                                'labelKey' => 'LBL_DELETE',
                                'asyncProcess' => true,
                                'params' => [
                                    'displayConfirmation' => true,
                                    'confirmationLabel' => 'NTC_DELETE_CONFIRMATION',
                                ],
                                'klass' => ['btn btn-outline-danger btn-xs'],
                                'modes' => ['detail'],
                                'acl' => [],
                            ],
                        ],
                    ],
                ],
                'create' => [
                    'presetFields' => [
                        'parentValues' => [
                            'id' => 'parent_id',
                        ],
                        'static' => [
                            'parent_type' => 'Contracts'
                        ],
                    ],
                    'layout' => [
                        'header' => ['rows' => []],
                        'body' => [
                            'rows' => [
                                [
                                    'justify' => 'start',
                                    'class' => 'flex-grow-1',
                                    'cols' => [
                                        [
                                            'field' => [
                                                'name' => 'name',
                                            ],
                                            'labelDisplay' => 'top',
                                            'class' => 'flex-fill pr-2'
                                        ],
                                    ]
                                ],
                                [
                                    'justify' => 'start',
                                    'class' => 'flex-grow-1',
                                    'cols' => [
                                        [
                                            'field' => [
                                                'name' => 'description',
                                            ],
                                            'labelDisplay' => 'top',
                                            'class' => 'flex-fill pr-2'
                                        ],
                                    ]
                                ]

                            ]
                        ]
                    ],
                ],
                'loadMorePosition' => "bottom",
            ],
        ],
    ];

    $contracts['widgets'] = $widgets;
    $modules['contracts'] = $contracts;
    $bottomWidgets['modules'] = $modules;
    $container->setParameter('module.recordview.bottom_widgets', $bottomWidgets);
};

This is happening on a fresh installation of SuiteCRM 8.7 on a LAMP stack using the CRM’s sample data.

Any help would be greatly appreciated

I have made a bit of progress, I can make it appear now.

I had not change the record view routing to use 8. once this enabled i can see the bottom widget bar is there but still not notes.

If i add

    'sidebarWidgets' => [
         
      ],

in the legacy customer viewdef then not much happens.

If i fill it with a nonsense widget the notes appears and works, but the a widget appears in the side bar with an error message.

for instance

    'sidebarWidgets' => [
          [
              'type' => 'record-thread',
              'acls' => [
                  'AOS_Contracts' => ['view', 'list']
              ]
          ],
      ],

I’m still working on this, but feel free to jump in and tell me where i have gone wrong!

Thanks

This is to make notes like you made:

This is about adding quick chart but maybe it will help you to know about insights.

Maybe you’re looking for this :thinking: :thinking: :eyes: