AnsweredAssumed Answered

Create Admin settings for custom module

Question asked by Yury Voloshin on Dec 7, 2018
Latest reply on Dec 10, 2018 by Yury Voloshin

I'm having trouble creating Admin settings parameters for a custom module using Sugar 8.2. First, by following this post I created a new panel on the Admin page with a single link link inside of it by placing this code in custom\Extension\modules\Administration\Ext\Administration\MonitorSugar2SvcNowAdminPanel.php:

 

<?php
$admin_option_defs = array();
$admin_option_defs['Administration']['MonitorSugar2SvcNowConfiguration'] = array(
"LBL_MONITORSUGAR2SVCNOW_ADMIN_LINK",
"LBL_MONITORSUGAR2SVCNOW_ADMIN_LINK_TITLE",
"LBL_MONITORSUGAR2SVCNOW_ADMIN_LINK_DESC",
"./index.php?module=snow_Sugar2SvcNowIntegration&action=monitorSugar2SvcNow-settings"
);

$admin_group_header[]= array(
'LBL_MONITORSUGAR2SVCNOW_ADMIN_PANEL_TITLE',
'',
false,
$admin_option_defs,
'LBL_MONITORSUGAR2SVCNOW_ADMIN_PANEL_DESC'
);

Next, I tried to have the link in the Admin panel point to a form with a single text field, where the administrator will be able to enter email addresses to be used by the custom module to send automatic notifications. The custom module is called snow_Sugar2SvcNowIntegration and the settings are used by a scheduled job called MonitorSugar2SvcNowConfiguration. While following this post and the Creating Layouts page of the Developer Guide, I added layout and view files like this:

 

Layout in custom\clients\base\layouts\monitorSugar2SvcNow-settings\monitorSugar2SvcNow-settings.php

 

 

<?php

$viewdefs['base']['layout']['monitorSugar2SvcNow-settings'] = array(
    'type' => 'simple',
    'components' => array(
        array(
            'view' => 'monitorSugar2SvcNow-settings',
        ),
    ),
);

 

View in custom\clients\base\views\monitorSugar2SvcNow-settings\monitorSugar2SvcNow-settings.hbs

 

<p> Hello world.</p>

Controller in custom\clients\base\views\monitorSugar2SvcNow-settings\monitorSugar2SvcNow-settings.js

{
    className: 'monitorSugar2SvcNow-settings',
});

 

All I expect here is to see the "Hello world" text when pointing to <sugar URL>/#snow_Sugar2SvcNowIntegration/layout/monitorSugar2SvcNow-settings. Instead, I see a blank white page. The route specified in $admin_option_defs (see above) is actually <sugar URL>/#snow_Sugar2SvcNowIntegration/monitorSugar2SvcNow-settings. When I go to this URL, I get a "page does not exist" error. Could someone please point out what I'm missing here?

Outcomes