How to Create custom View In Sugarcrm 9.x EP. ?

Hi All ,

I want To create custom View action page like own design and insert Code. within the module like leads. 

Parents
  • Hi,

    To create a custom view in module level we need to create layout and view in under the following path 

    Example : if you want to create a custom view in under Leads module

    Layout: /custom/modules/Leads/clients/base/layouts/my-layout/my-layout.php

    <?php
    $viewdefs['Leads']['base']['layout']['my-layout'] = array(
    'type' => 'simple',
    'components' => array(
    array(
    'view' => 'my-view',
    ),
    ),
    );

    View:

    /custom/modules/Leads/clients/base/views/my-view/my-view.js

    ({
    className: 'my-view tcenter',
    cubeOptions: {
    spin: false
    },
    events: {
    'click .sugar-cube': 'spinCube'
    },
    spinCube: function() {
    this.cubeOptions.spin = !this.cubeOptions.spin;
    this.render();
    }
    })

    /custom/modules/Leads/clients/base/views/my-view/my-view.hbs

    <style>
    div.my-view
    {
    padding-top: 5%;
    }
    div.my-view .sugar-cube
    {
    fill:#bbbbbb;
    height:200px;
    width:200px;
    display: inline;
    }

    </style>

    <h1>My View</h1>

    {{{subFieldTemplate 'sugar-cube' 'detail' cubeOptions}}}

    <p>Click to spin the cube!</p>

    Once the above files have created in respective path navigate to admin and give repair&rebuild.

    To access the view: http://{site url}/#<module>/layout/my-layout

    The above is for module without particular event from the record/list view

    we can also create a custom view based on the particular event in record like saving record or updating filed events then calling the custom view for this we have to write a js event record.js file

    Ans if you want to show the data in the view then we have to create REST API and parse the data from to the custom view.

    Below is the URL for your reference: https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_9.0/User_Interface/Layouts/Creating_Lay… 

Reply
  • Hi,

    To create a custom view in module level we need to create layout and view in under the following path 

    Example : if you want to create a custom view in under Leads module

    Layout: /custom/modules/Leads/clients/base/layouts/my-layout/my-layout.php

    <?php
    $viewdefs['Leads']['base']['layout']['my-layout'] = array(
    'type' => 'simple',
    'components' => array(
    array(
    'view' => 'my-view',
    ),
    ),
    );

    View:

    /custom/modules/Leads/clients/base/views/my-view/my-view.js

    ({
    className: 'my-view tcenter',
    cubeOptions: {
    spin: false
    },
    events: {
    'click .sugar-cube': 'spinCube'
    },
    spinCube: function() {
    this.cubeOptions.spin = !this.cubeOptions.spin;
    this.render();
    }
    })

    /custom/modules/Leads/clients/base/views/my-view/my-view.hbs

    <style>
    div.my-view
    {
    padding-top: 5%;
    }
    div.my-view .sugar-cube
    {
    fill:#bbbbbb;
    height:200px;
    width:200px;
    display: inline;
    }

    </style>

    <h1>My View</h1>

    {{{subFieldTemplate 'sugar-cube' 'detail' cubeOptions}}}

    <p>Click to spin the cube!</p>

    Once the above files have created in respective path navigate to admin and give repair&rebuild.

    To access the view: http://{site url}/#<module>/layout/my-layout

    The above is for module without particular event from the record/list view

    we can also create a custom view based on the particular event in record like saving record or updating filed events then calling the custom view for this we have to write a js event record.js file

    Ans if you want to show the data in the view then we have to create REST API and parse the data from to the custom view.

    Below is the URL for your reference: https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_9.0/User_Interface/Layouts/Creating_Lay… 

Children