Results 1 to 6 of 6

Thread: Custom Button in Detailview of Custom Module

  1. #1
    Join Date
    Sep 2010
    Posts
    12

    Default Custom Button in Detailview of Custom Module

    Hello again,

    this time i'm trying to recreate a problem which appears here very often and was solved very often but in my case i don't know what i am doing wrong.

    I tried the following approach in both SugarCRM 5.5 CE (already customized= and 6.03 CE (fresh install).

    1) i created a custom module via Module Builder
    2) i edited the file custom/modules/my_custom_module/metadata/detailviewdefs.php


    The first lines of the file before modification:
    Code:
    <?php
    $module_name = 'my_custom_module';
    $_object_name = 'my_custom_module';
    $viewdefs [$module_name] = 
    array (
      'DetailView' => 
      array (
        'templateMeta' => 
        array (
          'maxColumns' => '2',
    'form' => 
            array (
            ),
          'widths' =>
    and afterwards, one of several approaches trying to get a custom button in there
    Code:
    <?php
    $module_name = 'my_custom_module';
    $_object_name = 'my_custom_module';
    $viewdefs [$module_name] = 
    array (
      'DetailView' => 
      array (
        'templateMeta' => 
        array (
          'maxColumns' => '2',
    'form' => 
            array (
              'buttons' => 
              array (
                0 => 'EDIT',
                1 => 'DUPLICATE',
                2 => 'DELETE',
                3 => 'MY_CUSTOM_BUTTON',
              ),
            ),
          'widths' =>
    After saving the file, and reloading the page nothing changed. What am i mssing here?



    I then also tried changing other fields, but also with no effect
    Code:
     'panels' => 
        array (
          'default' => 
          array (
            0 => 
            array (
              0 => 
              array (
                'name' => 'document_name',
                'label' => 'LBL_DOC_NAME',
    to
    Code:
     'panels' => 
        array (
          'default' => 
          array (
            0 => 
            array (
              0 => 
              array (
                'name' => 'document_name',
                'label' => 'LBL_SF_CATEGORY',


    breaking the code is easy - resulting in a white empty page, therefore i don't believe it's caching or the wrong file i'm editing.
    Code:
     array (
                'name' => 'document_name',
    to
    Code:
     arrrrrrray (
                'name' => 'document_name',
    Last edited by best_kobe_beef; 2010-11-24 at 11:46 AM.

  2. #2
    andopes's Avatar
    andopes is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Jul 2006
    Location
    São Paulo - Brazil
    Posts
    8,335

    Default Re: Custom Button in Detailview of Custom Module

    Custom Buttons on SugarCRM must be accomplished just like Convert Lead button on Leads DetailView.

    Regards
    André Lopes
    DevToolKit / Project of the Month - June 2009
    Lampada Global Services- Open Source Solutions
    Avenida Ipiranga, 318
    Bloco B - CJ 1602
    São Paulo, SP 01046-010
    Brazil
    Office: +55 11 3237-3110
    Mobile: +55 11 7636-5859
    e-mail: andre@lampadaglobal.com

    Lampada Global delivers offshore software development and support services to customers around the world.
    Lampada is proud to be a SugarCRM Gold Partner, revolutionizing Customer Relationship Management.

    I DO NOT answer questions through PM and Email. If you need some help post your question into SugarForum.

  3. #3
    Join Date
    Sep 2010
    Posts
    12

    Default Re: Custom Button in Detailview of Custom Module

    Quote Originally Posted by andopes View Post
    Custom Buttons on SugarCRM must be accomplished just like Convert Lead button on Leads DetailView.
    Regards
    Hello andopes! Thanks for your reply, can you give me a hint on how to implement it here? I already looked at various of your posts and tried that approach, one example of such a post here:
    http://www.sugarcrm.com/forums/showthread.php?t=58036

    more details added into the first post (renaming labels had also no effect for example).

    Maybe i do have to explicitely combine both steps
    1) modify detailview
    2) create controller

    or said in other words: before the button even appears, a controller has to exist?
    Last edited by best_kobe_beef; 2010-11-24 at 11:55 AM.

  4. #4
    Join Date
    Sep 2010
    Posts
    12

    Default Re: Custom Button in Detailview of Custom Module

    To answer my question myself:
    Steps 1 and 2 must both be finished for changed to be applied.

    After changing the button array AND creating controller.php, something happens (blank page, well....) when changing the filename of controller.php to acontroller.php, i indeed do have the unchanged website presented.

    Therefore i now need to look into how to correctly implement code into controller.php, but i think i will get to that quickly looking into other threads.

  5. #5
    andopes's Avatar
    andopes is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Jul 2006
    Location
    São Paulo - Brazil
    Posts
    8,335

    Default Re: Custom Button in Detailview of Custom Module

    It is interesting to understand the MVC architectural pattern and the SugarCRM MVC Framework as well.

    Whenever you send some request to Sugar the Controller process this request and forward it to a view, if applicable.
    The action of button, you are going to implement, is fetched by Controller, so Sugar Controller look for a function called "action_<action_name>" where <action_name> is the own action you configured into your button.
    This function on controller may figure out, by itself, all the stuffs, or invoke a view if applicable.

    Take a look on modules/Leads/metadata/detailviewdefs.php

    Regards
    André Lopes
    DevToolKit / Project of the Month - June 2009
    Lampada Global Services- Open Source Solutions
    Avenida Ipiranga, 318
    Bloco B - CJ 1602
    São Paulo, SP 01046-010
    Brazil
    Office: +55 11 3237-3110
    Mobile: +55 11 7636-5859
    e-mail: andre@lampadaglobal.com

    Lampada Global delivers offshore software development and support services to customers around the world.
    Lampada is proud to be a SugarCRM Gold Partner, revolutionizing Customer Relationship Management.

    I DO NOT answer questions through PM and Email. If you need some help post your question into SugarForum.

  6. #6
    Join Date
    Sep 2010
    Posts
    12

    Default Re: Custom Button in Detailview of Custom Module

    Quote Originally Posted by andopes View Post
    It is interesting to understand the MVC architectural pattern and the SugarCRM MVC Framework as well.

    Whenever you send some request to Sugar the Controller process this request and forward it to a view, if applicable.
    The action of button, you are going to implement, is fetched by Controller, so Sugar Controller look for a function called "action_<action_name>" where <action_name> is the own action you configured into your button.
    This function on controller may figure out, by itself, all the stuffs, or invoke a view if applicable.

    Take a look on modules/Leads/metadata/detailviewdefs.php

    Regards
    Thanks for the architectural explanation and your patience. I am confident i can now solve that problem looking into modules/Leads/metadata/detailviewdefs.php and working my way from there to the custom logic implementation in the controller.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Warning in my detailview of custom module
    By krakoss2 in forum Help
    Replies: 6
    Last Post: 2011-01-04, 02:52 PM
  2. Add new custom button to list view of custom module
    By rob78 in forum Developer Tutorials
    Replies: 7
    Last Post: 2010-02-19, 08:06 AM
  3. detailview problem in own custom module
    By rraushan2007 in forum Developer Help
    Replies: 1
    Last Post: 2008-08-30, 09:27 AM
  4. detailview problem in custom module
    By rraushan2007 in forum Developer Help
    Replies: 3
    Last Post: 2008-08-30, 04:49 AM
  5. Replies: 0
    Last Post: 2007-11-21, 12:08 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •