Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Adding a custom button to top of Detail view in Sugar 5

  1. #1
    mipapage is offline Sugar Community Member
    Join Date
    Oct 2007
    Location
    Spain
    Posts
    90

    Default Adding a custom button to top of Detail view in Sugar 5

    Hey all,

    As the subject says, I need to add a custom button to the top of the detail view in the opportunities module in Sugar 5. Can someone point me in the direction where to find this? (i.e. a php or tpl file where I may be able to insert this) Things seem a bit different from Sugar 4.x, of which I have about two weeks of experience

  2. #2
    Superman's Avatar
    Superman is offline Sugar Community Member
    Join Date
    Oct 2005
    Location
    Kazakhstan
    Posts
    852

    Default Re: Adding a custom button to top of Detail view in Sugar 5

    Look for sample at: modules/Meetings/metadata/detailviewdefs.php.
    PHP Code:
    ....
    'templateMeta' => array('form'=>array('buttons'=>array('EDIT''DUPLICATE', array('customCode'=>'<input type="button" value="TEST" />'))
    .... 
    this will show Edit, Duplicate, TEST buttons to detailview screen
    Farkhad Rakhimzhanov
    E-mail: farkhad@gmail.com
    Skype: rakikama

    SuperTimesheet and Invoicing — timesheet tool with invoicing for SugarCRM.
    Book time against Cases, Project Tasks and Projects.
    Create invoice regarding booked time, print it in PDF or HTML,
    customize template as you like.

  3. #3
    mipapage is offline Sugar Community Member
    Join Date
    Oct 2007
    Location
    Spain
    Posts
    90

    Default Re: Adding a custom button to top of Detail view in Sugar 5

    Thanks Superman,

    I had tried that with modules/Opportunities/metadata/detailviewdefs.php, but it did not seem to work. Should I have cleared a cache somewhere?

    I tried adding to the code below, and editing it but nothing happened... In fact I have tested emptying the whole file, and no change was observed. This lead me to cache cleaning, which I also tried but to no avail...

    PHP Code:
    $viewdefs['Opportunities']['DetailView'] = array(
        
    'templateMeta' => array('form' => array('buttons'=>array('EDIT''DUPLICATE''DELETE'
                                                             array(
    'customCode'=>'<input title="{$APP.LBL_DUP_MERGE}" ' .
                                                                     
    'accesskey="M" ' .
                                                                     
    'class="button" ' .
                                                                     
    'onclick="this.form.return_module.value=\'Opportunities\';this.form.return_action.value=\'DetailView\';this.form.return_id.value=\'{$fields.id.value}\'; this.form.action.value=\'Step1\'; this.form.module.value=\'MergeRecords\';" ' .
                                                                     
    'name="button" ' .
                                                                     
    'value="{$APP.LBL_DUP_MERGE}" ' .
                                                                     
    'type="submit">'),
                                                                    )),
                                   
    'maxColumns' => '2'
                                
    'widths' => array(
                                                array(
    'label' => '10''field' => '30'), 
                                                array(
    'label' => '10''field' => '30')
                                                ),
                               ), 
    Last edited by mipapage; 2007-12-18 at 12:12 PM.

  4. #4
    Superman's Avatar
    Superman is offline Sugar Community Member
    Join Date
    Oct 2005
    Location
    Kazakhstan
    Posts
    852

    Default Re: Adding a custom button to top of Detail view in Sugar 5

    Yes, you need to clear cache.
    Admin -> Repair -> Clear Template Data Cache
    Farkhad Rakhimzhanov
    E-mail: farkhad@gmail.com
    Skype: rakikama

    SuperTimesheet and Invoicing — timesheet tool with invoicing for SugarCRM.
    Book time against Cases, Project Tasks and Projects.
    Create invoice regarding booked time, print it in PDF or HTML,
    customize template as you like.

  5. #5
    mipapage is offline Sugar Community Member
    Join Date
    Oct 2007
    Location
    Spain
    Posts
    90

    Default Re: Adding a custom button to top of Detail view in Sugar 5

    Thanks again Superman,

    I tried that, although its a bit different in 5.0 (see attached screenshot).

    I did, however, try clearing and repairing the whole thing, again to no avail.

    I also tried, again, uploading a blank file and clearing the caches etc. and nothing. Doublechecked the file, got the right one, it uploads properly etc etc.

    I'm going to take a little break and come back and rm -rf / the whole rack :-)
    Attached Images Attached Images  

  6. #6
    Superman's Avatar
    Superman is offline Sugar Community Member
    Join Date
    Oct 2005
    Location
    Kazakhstan
    Posts
    852

    Default Re: Adding a custom button to top of Detail view in Sugar 5

    1. Make sure you are looking at DetailView screen
    2. Try to add new button code in custom/modules/Opportunities/metadata/detailviewdefs.php, in case this file exists there.
    Farkhad Rakhimzhanov
    E-mail: farkhad@gmail.com
    Skype: rakikama

    SuperTimesheet and Invoicing — timesheet tool with invoicing for SugarCRM.
    Book time against Cases, Project Tasks and Projects.
    Create invoice regarding booked time, print it in PDF or HTML,
    customize template as you like.

  7. #7
    mipapage is offline Sugar Community Member
    Join Date
    Oct 2007
    Location
    Spain
    Posts
    90

    Default Re: Adding a custom button to top of Detail view in Sugar 5

    Good thinking on #1, although I'm pretty bug-eyed from reading too much code I did have this right, but, #2 was it!! Nice work Superman. Many, many thanks-you's for sticking this out with me.

  8. #8
    Superman's Avatar
    Superman is offline Sugar Community Member
    Join Date
    Oct 2005
    Location
    Kazakhstan
    Posts
    852

    Cool Re: Adding a custom button to top of Detail view in Sugar 5

    I am just doing my job
    Farkhad Rakhimzhanov
    E-mail: farkhad@gmail.com
    Skype: rakikama

    SuperTimesheet and Invoicing — timesheet tool with invoicing for SugarCRM.
    Book time against Cases, Project Tasks and Projects.
    Create invoice regarding booked time, print it in PDF or HTML,
    customize template as you like.

  9. #9
    mipapage is offline Sugar Community Member
    Join Date
    Oct 2007
    Location
    Spain
    Posts
    90

    Default Re: Adding a custom button to top of Detail view in Sugar 5

    Nice answer ;-)

    Those {$fields.id.value} kinda tags are going to be very useful.

  10. #10
    julian's Avatar
    julian is offline Sugar Team Member
    Join Date
    Sep 2004
    Posts
    1,639

    Default Re: Adding a custom button to top of Detail view in Sugar 5

    Hello mipapage,

    Also, just as a note (since you're new to Sugar), you should always try to apply changes in the ./custom/ directory. Changes made directly to the core Sugar files (for example, any files in ./modules/...) will require a merge when you upgrade Sugar, or will be lost.

    You also may consider turning on 'Developer Mode' while you're performing customizations. It will disable all caching until you turn it off. To turn on Developer Mode:

    1) login as an admin
    2) click the Admin link on the top-right of the screen
    3) click the System Settings link
    4) check Developer Mode (on the bottom-right corner of System Settings)

    Enjoy, and keep posting your questions here!
    Julian Ostrow
    Systems and Applications Engineer
    SugarCRM Inc.

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Custom Development
    By mtembene in forum Developer Help
    Replies: 4
    Last Post: 2011-08-01, 02:30 AM
  2. custom field to sugar field
    By tanhaa in forum Developer Help
    Replies: 2
    Last Post: 2011-05-04, 03:52 PM
  3. Problem with "Accounts" view -Sugar 4.5.0f -Linux
    By vaibhavd in forum General Discussion
    Replies: 0
    Last Post: 2006-12-13, 10:44 AM
  4. Asterisk Patch 1.1.0 Crash on logon
    By skyracer in forum Help
    Replies: 6
    Last Post: 2006-07-08, 06:30 AM

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
  •