Create Admin settings for custom module

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?

Parents
  • I have some Confusion Above Solution--

    1- Where We can find this $admin_option_defs

    or 

    "./index.php?module=snow_Sugar2SvcNowIntegration&action=/layout/monitorSugar2SvcNow-settings"
    This line in above code ?.
    2- custom\clients\base\views\monitorSugar2SvcNow-settings\monitorSugar2SvcNow- Above Mention this URL path will be main  Directory or custom/module/<module_name>/ etc because in custom directory we are unable to fine client/base folder.
    ?
    please help.

     

Reply
  • I have some Confusion Above Solution--

    1- Where We can find this $admin_option_defs

    or 

    "./index.php?module=snow_Sugar2SvcNowIntegration&action=/layout/monitorSugar2SvcNow-settings"
    This line in above code ?.
    2- custom\clients\base\views\monitorSugar2SvcNow-settings\monitorSugar2SvcNow- Above Mention this URL path will be main  Directory or custom/module/<module_name>/ etc because in custom directory we are unable to fine client/base folder.
    ?
    please help.

     

Children
  • Hi M kumar,

    I apologize about the delayed reply. The PHP file containing $admin_option_defs has to be created in

    custom/Extension/modules/Administration/Ext/Administration/<your file name>.php.

    You should follow the format in either my post or in the referenced post. 

    Same thing goes for the $viewdefs array in custom/clients/base/layouts/<your directory>/<your file name>.php . You'll need to create the custom/clients/base folder if this folder doesn't exist.