VTAP Javascript APIs

VTAP Javascript APIs

VTAP global object provides several helper methods to make development of in-app customization of CRM or building applications easier.

VTAP.Component

This namespace provides utility functions that enable working with Vtiger Components.

VTAP.Component.Core

This the base UI class that should be extended to create any new Component or Page.

Creating Basic Button Component

var MyModule_Component_BasicButton = VTAP.Component.Core.extend({ });

Creating Settings View

var MyModule_Component_SettingsView = VTAP.Component.Core.extend({ });

Core Components follow VueJS Component Lifecycle hooks and events (read).

var  MyModule_Component_RegisterButton = VTAP.Component.Core.extend({
    props : { 
        //add props from the parent
    }, 
    data() { 
        return {
            //add your component data variables here
        }
    }, 
    components :{ 
        //add other child components here if used in templates
    },
    computed : {
        //add computed properties
    },
    created() {
        //add other component registration or listen to vtiger events
        //perform ajax request required for your component.
    },
    mounted() {
        //this is called after component is mounted on the DOM
    },
    template :
        `<div>Custom component structure</div>`
});

VTAP.Component.Load

VTAP.Component.Load (name, module)

Loads and returns Vtiger component object

Parameters

name String component name
module String module name

Returns

Object Vtiger Component object

VTAP.Component.Find

VTAP.Component.Find(name)

returns a Vtiger component object if available.

Parameters

name String component name
return String module name

Returns

Object Vtiger Component object

VTAP.Component.Register

VTAP.Component.Register(type, data, component, filter)

Add and Return custom component on a Page.

Parameters

type String type of component to be added, click here for complete list with examples.
data Object Many components only depend on data to show in UI, these are generally key-value pair values. See component types for examples
component Vtiger component Custom component that you want to render in the UI.
filter object Use this when you want to restrict the component to be loaded for a particular module. For example {‘module’:’Contacts’)

Returns

Object Vtiger Component object

This API allows subscribing to UI Event Hooks that are emitted by core or custom components on the page. Visual representation of the hooks is shown below:

See all List Page UI Hooks exposed here

See Detail Page UI Hooks here.

VTAP.View

Get current page view name like list, detail etc.

VTAP.User

Get logged in user details like first name, last name, email, profile image, isadmin etc.

VTAP.Utility

Provides utility functions like showing modal, show success/error UI notification etc.

VTAP.Utility.ShowSuccessNotification

VTAP.Utility.ShowSuccessNotification(message)

Shows success UI notification - useful to inform success after the action.

message String The message that needs to be shown in notification. Default values to "Success".

VTAP.Utility.ShowErrorNotification

VTAP.Utility.ShowErrorNotification(message)

Shows the error UI notification - useful to inform users about failed actions.

message String

Default = "Error"

The message that needs to be shown in notification.

VTAP.Utility.ShowPopup

VTAP.Utility.ShowPopup({component, componentData, modalOnModalMode})

Shows a popup modal

component Vtiger Component This is Vtiger Vue component, see here for more details.
componentData Object It will hold parameters that need to be sent to the Vtiger component to be shown in popup.
modalOnModalMode Boolean

Default = false

If there is another popup then do you want to show the modal on top of it or not. Default
VTAP.Utility.ShowPopup({
    component : VTAP.Component.Load('Relation', 'MYMODULE'),  
    componentData : {title : 'List of records'}, 
    modalOnModalMode : true
});

var MYMODULE_Component_Relation = VTAP.Component.Core.extend({
   template:
   //We are using boostrap-vue components b-modal here. Check [here](https://bootstrap-vue.org/docs/components/modal) more details.
      `<b-modal id="modal-1" title="Vtiger popup">
          <p class="my-4">Add popup contents here</p>
       </b-modal>`
});

VTAP.Utility.HidePopup

VTAP.Utility.HidePopup() - This will hide the popup opened by ShowPopup API.

VTAP.Utility.UserLabels

VTAP.Utility.UserLabels() - This returns a list of all the CRM users and their ids. This is useful to identify owner of the record as API's return back in the form of ID.

VTAP.Utility.ShowProgress

VTAP.Utility.ShowProgress() - This can be used to when some background tasks like fetching data from the server is initiated, and inform user to wait for the job to complete.

VTAP.Utility.HideProgress

VTAP.Utility.HideProgress() - This is used to hide the progress bar initiated by ShowProgress API.

VTAP.Utility.ShowRecordPreview

This API lets you see the preview of a CRM record, given you have crm ID and the name of the module.

id String This is the CRM record ID.
module String Module name
VTAP.Utility.ShowRecordPreview('1234', 'Contacts')

VTAP.Utility.ShowRecordCreate

VTAP.Utility.ShowRecordCreate(record,module,callback)

Shows a quickcreate popup modal

record Object Here we need to send params to which quickcreate modal fields will be populated with that data
module String Module name
callback function user handler function
VTAP.Utility.ShowRecordCreate(
        {'fieldname':'fieldvalue'},
        'MODULENAME',
        ()=>{}
);

var MYMODULE_Component_ComponentName = VTAP.Component.Core.extend({
    //Here record is injected by the VTAP framework.
    props : ['record'],
    created() {
        var showRecordCreate = ()=>{
            VTAP.Utility.ShowRecordCreate(this.record,'MODULENAME',()=>{});
        };
        VTAP.Component.Register('DETAIL_BASIC_BUTTON', 
                                {label:'Custom', 
                                icon:'fa-pencil', 
                                variant:'primary', 
                                clickHandler : showRecordCreate
                            }, '', {module:'MODULENAME'});
   }
});

VTAP.Utility.ShowRecordEdit

VTAP.Utility.ShowRecordEdit(record,module,callback)

Shows a edit popup modal of a record

record Object Vtiger_Record_Model object
module String Module name
callback function user handler function
let record = Vtiger_Record_Model.getCleanInstance();
record.set('id', '12345');

VTAP.Utility.ShowRecordEdit(record, 'Contacts', () => {
    //callback function
});

VTAP.Utility.ShowRecordDelete

VTAP.Utility.ShowRecordDelete(record,module)

Shows a delete popup confirmation of a record.

record Object Vtiger_Record_Instance object
module String Module name
let record = Vtiger_Record_Model.getCleanInstance();
record.set('id', '12345');

VTAP.Utility.ShowRecordDelete(record, 'Contacts', () => {
    //callback function
});

VTAP.List

Provides helper function to work on List View Page.

VTAP.List.Records

VTAP.List.Records() returns current record objects available in the list page.

Returns

void It does not have a return value

VTAP.List.NextPageExist

VTAP.List.NextPageExist() - checks if there are records in the next page.

Returns

Boolean Returns true if records exists in next page, if not then returns false

VTAP.List.PrevPageExist

VTAP.List.PrevPageExist() : checks if there are records in the previous page.

Returns

Boolean Returns true if records exists in previous page else returns false

VTAP.List.NextPage

VTAP.List.NextPage() : moves the current page to the next page.

Returns

void It does not have a return value

VTAP.List.PreviousPage

VTAP.List.PreviousPage() : moves the current page to the previous page if it exists.

Returns

void It does not have a return value

VTAP.List.Reload

VTAP.List.Reload() : reloads the current page, all the meta data are retained like page, search, ordering etc. It only reloads the list page records not the entire page.

Returns

void It does not have a return value

VTAP.List.Search(searchobject) : It searches for the search string, you can search for multiple fields. It searches for those fields that are available in the UI.

Parameters

searchobject object javascript map of fieldname and search string.

Example : VTAP.List.Search({'firstname':'John', 'lastname':'wick'})

VTAP.List.ClearSearch

VTAP.List.ClearSearch() : It will remove all the search values applied for all the fields.

Returns

void It does not have a return value

VTAP.List.Sort

VTAP.List.Sort(fieldname, order) : It will sort the list page with the fieldname.

Parameters

fieldname String Name of the field on which sort has to be applied
order String

Default = 'desc'

'asc' for ascending order, 'desc' for descending order.

VTAP.List.SelectedRecords

VTAP.List.SelectedRecords() : It gives a list of records selected in the list page.

Returns

Promise Returns Promise function, use a handler to get the list of records.

It returns an array of record id's.

Example :

VTAP.List.SelectedRecords().then( (records) => {
    console.log(records);
});

VTAP.Detail

Provides helper functions to work with Detail View Page.

VTAP.Detail.Id

VTAP.Detail.Id() : If you are in the detail page, then it returns record id.

Returns

integer it returns record id

VTAP.Detail.Module

VTAP.Detail.Module() : This function returns the name of the module.

Returns

string it returns module name

VTAP.Detail.Record

VTAP.Detail.Record() : It returns a current record object.

Returns

Promise It returns Promise function, use handler to get record object
VTAP.Detail.Record().then( (record) => {
        //record is of type Vtiger_Record_Model
})

VTAP.Detail.Relations

VTAP.Detail.Relations() : This function returns all the relationship meta with the current record(module).

Returns

Promise It returns Promise function, use handler to get relation objects
VTAP.Detail.Relations().then( (relations) => { });

VTAP.Detail.Relation

VTAP.Detail.Relation(module) : Use this function to get relation meta for a particular module.

module String module name of the relation

Returns

Promise It returns Promise function, use handler to get relation object
VTAP.Detail.Relation('Contacts').then( (relations) => { });

VTAP.Detail.RelatedRecords

VTAP.Detail.RelatedRecords(module, filterobject) : It returns related records of the current record.

module String module name of the relation
filterobject object filterobject lets you set a page, filter conditions etc.

Returns

Promise It returns Promise function, use handler to get filtered records
VTAP.Detail.RelatedRecords('Contacts', {page : 2, filter : [] }).then(
(records) => {
    console.log(records);
});

VTAP.Detail.RelatedRecordsCount

VTAP.Detail.RelatedRecordsCount(module, filterobject) : It gives you total records available in the relation.

module String module name of the relation
filterobject object filterobject lets you set filter conditions etc.

Returns

Promise It returns Promise function, use handler to get filtered records
VTAP.Detail.RelatedRecordsCount('Contacts', {filter : [ ] }).then( (count) => { });

VTAP.Detail.ShowRelatedRecordCreate

VTAP.Detail.ShowRelatedRecordCreate(record,module,callback) : It opens QuickCreateRelatedModal popup and allows to create related records

record Object Get detail recordmodel send as record object ,you can see here for reference
module String Related Module name
callback function user handler function

var MYMODULE_Component_DetailButton = VTAP.Component.Core.extend({
    var showRelatedRecordCreate = ()=>{
        VTAP.Detail.Record().then((record)=>{
                    VTAP.Detail.ShowRelatedRecordCreate(record,'Tasks',()=>{});
            })
    };
    VTAP.Component.Register('DETAIL_BASIC_BUTTON', 
                                {label:'Custom', 
                                icon:'fa-pencil', 
                                variant:'primary', 
                                clickHandler : showRelatedRecordCreate
                            }, '', {module:'Deals'});
});

VTAP.Modules

Provides helper function to get access to module meta information on any page.

VTAP.Modules.CurrentModuleName

VTAP.Modules.CurrentModuleName() : returns current module name.

Returns

String name of the module

VTAP.Modules.CurrentModuleModel

VTAP.Modules.CurrentModuleModel() : It returns current module meta information.

Returns

Promise It returns Promise function, use handler to get module object
VTAP.Modules.CurrentModuleModel().then( (moduleObject) => { });

VTAP.Modules.GetModule

VTAP.Modules.GetModule(modulename) : It returns module meta information for passed modulename.

modulename String name of the module

Returns

Promise It returns Promise function, use handler to get module object
VTAP.Modules.GetModule('Contacts').then( (moduleObject) => { })

VTAP.Modules.GetAll

VTAP.Modules.GetAll() : It returns list of accessible modules

Returns

Promise It returns Promise function, use handler to get module list
VTAP.Modules.GetAll().then( (moduleList) => { });

VTAP.Api

Provides helper functions to interact with core product APIs. For more details on see here

VTAP.Api.Get

VTAP.Api.Get(uri, parameters, callback) : Performs get request on the uri and returns the response to the callback handler.

uri String unique server resources, see here for the [list](Core-server-resources)
parameters Object parameters required for the uri, it is to be given in key-value format
callback function(error, success) handler function gets response from server

Example: To retrieve record information

VTAP.Api.Get('records', {id : VTAP.Detail.Id(), 
  module : VTAP.Detail.Module()}, (error, response) => {
    //response has record data
});

VTAP.Api.Post

VTAP.Api.Post(uri, parameters, callback) : It is used to add new resources to the server.

uri String unique server resources, see here for the [list](Core-server-resources)
parameters Object parameters required for the uri, it is to be given in key-value format
callback function(error, success) handler function gets response from server

Example : To add a Contact record

VTAP.Api.Post('records', {module : 'Contacts', firstname : 'John', 'lastname' : 'Wick', 'email' : 'john@wick.com'}, (error, response) => {
    //response will have record data
});

VTAP.Api.Put

VTAP.Api.Put(uri, parameters, callback) : It updates an existing resource on the server.

uri String unique server resources, see here for the list [list](Core-server-resources)
parameters Object parameters required for the uri, it is to be given in key-value format
callback function(error, success) handler function gets response from server

Example: To update Contact record, id is the record crmid or the id you see in the url of detail page.

VTAP.Api.Put('records', {module : 'Contacts', id : '123', 'email' : 'newjohn@newwick.com'}, (error, response) => {
    //response will have record data
});

VTAP.Api.delete

VTAP.Api.delete(uri, parameters, callback) : This function deletes a resource on the server.

uri String unique server resources, see here for the [list](Core-server-resources)
parameters Object parameters required for the uri, it is to be given in key-value format
callback function(error, success) handler function gets response from server

Example: To delete a Contact record.

VTAP.Api.Delete('records', {module : 'Contacts', id : '123'}, (error, response) => { });

VTAP.CustomApi

Provides helper functions to invoke API defined through API Designer using logged in user context. Signature of the functions are similar to VTAP.Api scope.

VTAP.CustomApi.Get

VTAP.CustomApi.Get(uri, parameters, callback) : Performs get request on the uri and returns the response to the callback handler.

uri String unique server resources created from API Designer
parameters Object parameters required for the uri, it is to be given in key-value format
callback function(error, success) handler function gets response from server

Example: To retrieve weather of a Mailing City of a Contact (get_weather added from Api Designer)

VTAP.Detail.Record().then( (record) => { 
    VTAP.CustomApi.Get('get_weather', {'city' : record.mailingcity}, 
        (error, response) => {
            //response has record data
        });
});

VTAP.Event

Provides helper functions register, unregister and listen on Vtiger UI Events.

VTAP.Event.Register

VTAP.Event.Register(eventname, handlerName) : It allows you to register for vtiger events or custom events.

eventname String name of the event, list of supported events are here
handlerName function handler function

Example: To listen for detail preview popup to show up.

function handler() { }
VTAP.Event.Register('DETAIL_PREVIEW_SHOWN', handler);

VTAP.Event.DeRegister

VTAP.Event.DeRegister(eventname, handlerName) : You can de-register for events that you have registered with the Event.Register API. Parameters and return type are the same as the Register API.

Example :

function handler() { }

VTAP.Event.DeRegister('DETAIL_PREVIEW_SHOWN', handler);

VTAP.Event.Trigger

VTAP.Event.Trigger(eventname, data) : You can trigger custom events using this API, generally used when you have custom buttons, links and widgets.

eventname String name of the event, list of supported events are here
data Object key value pair of data that you want to send to the listening handler.

Example: To trigger a custom event on a page..

VTAP.Event,Trigger('MY_CUSTOM_EVENT', ({"id":VTAP.Detail.Id(), "module":VTAP.Detail.Module()});

VTAP.Notification

Provides helper functions to work with real-time notifications.

VTAP.Notification.Trigger

VTAP.Notification.Trigger(module, data) : This is used to send real-time notification from client-side to other connected users on the same module.

module String name of the module
data Object key value pair of data that you want to send to the listening handler.

Example: To trigger notification on Contact Detail View for all connected users.

VTAP.Notification,Trigger('Contacts', ({"id":VTAP.Detail.Id(), "user_name":VTAP.User().user_name, "mode":"accessed"});

Example: To trigger notification on Contact Detail View for only specific connected users.

VTAP.Notification,Trigger('Contacts', ({"id":VTAP.Detail.Id(), "user_name":VTAP.User().user_name, "mode":"accessed","users": [1, 6]});

VTAP.Notification.Listen

VTAP.Notification.Listen(module, callback): This helps you listen on the event notification sent using VTAP.Notification.Trigger api.

module String name of the module
callback function user handler function

Example: To listen to notification triggers.

VTAP.Notification,Listen('Contacts', (data) => {
    //data has the custom info send from Notification.Trigger api
});

VTAP.AppData

Provides helper functions to work with custom data shared across target modules or applications.

VTAP.AppData.Save

VTAP.AppData.Save(module, data, callback) : It saves the data for the module.

module String name of the module
data object data_key is used to store the key and data_value is where actual data is stored. Use onlyadmin flag to allow only admins to read/write. Ex : ({"data_key":"secret", "data_value":"wrfs3fr","onlyadmin":true})
callback function user handler function

Example:

VTAP.AppData.Save("my_extension_name", {"data_key" : "username", "data_value" : "something@email.com"}, (error, success) => {

});

VTAP.AppData.Get

VTAP.AppData.Get(module, data, callback) : This is used to fetch the app data that is stored using VTAP.AppData.Save api.

module String name of the module
data object data_key is used to retrieve the key. Ex : ({"data_key":"secret"})
callback function user handler function

Example :

VTAP.AppData.Get("my_extension_name", {"data_key":"username"}, 
(error, success) => {

});

VTAP.AppData.Delete

VTAP.AppData.Delete(module, data, callback) : It will delete the data which was saved using Save api. You need to pass data_key to identify the data to be deleted.

module String name of the module
data object data_key is used to retrieve the key. Ex : ({"data_key":"secret"})
callback function user handler function
VTAP.AppData.Delete("my_extension_name", {"data_key" : "username"},
(error, success) => {

});

VTAP.PrefsData

Similar to VTAP.AppData this namespace provides helper functions for the module or application to persist preference information of each User.

NOTE: There can only be one data_key for (module or application) and user.

VTAP.UserData

Similar to VTAP.AppData this namespace provides helper functions for the module or application to persist user specific records in the data store.

NOTE: There can be one or more data_key for (module or application) and user. Each record would have its ID auto generated on first save.

VTAP.UserData.Save

VTAP.UserData.Save(module, data, callback) : It is used to save user data.

Example:

VTAP.UserData.Save("extension_name", {"data_key" : "conversation", "data_value" : "Hello"}, 
(error, success) => {
//success returns "id" index which can be used to perform Get and //Delete operation for the "data_key"
}); 

If you want to share the data with any particular users then pass sharedusers, sharedusers will be able to access the same data with data_key.

VTAP.UserData.Save("extension_name", {"data_key" : "Task", "data_value" : {name : 'Review Home Page'}, "sharedusers" : [2,3]}, 
(error, result) => { 

});

VTAP.UserData.Get

VTAP.UserData.Get(module, data, callback : It will fetch the data saved by UserData.Save api. If you pass "id" in data then it will fetch that particular data set, else it will fetch all the data stored with "data_key".

Example:

VTAP.UserData.Get("extension_name", {"data_key" : "conversation", "id" : "23"}, (error, success) => {

});

VTAP.UserData.Delete

VTAP.UserData.Delete(module, data, callback : It will delete the data saved by UserData.Save api.

Example:

VTAP.UserData.Delete("extension_name", {"data_key" : "conversation", "id" : "23"}, (error, success) => {

});

VTAP.Resource

Provides helper functions to include external resources like Javascript libraries, style sheets.

VTAP.Resource.Require

VTAP.Resource.Require(path, type) : This will let you add external resources to use them in your components.

path String Path to external script
type String Default value is “script”, if you are including style sheets then set type as “style”

Example :

VTAP.Resource.Require('https://unpkg.com/leaflet@1.6.0/dist/leaflet.js');

Note : Before using any resource you need to whitelist the domain in Module Designer > Settings > Add Domain.

VTAP.OAuth

Provides a helper function to gather the OAuth grant from the user of the application to further interact with APIs of third-party-services (setup through API designer).

VTAP.OAuth.Authorize

This will open up the service that is registered for the module. This depends on the oauth client app that you have registered in your application.

Any OAuth needs an client app to be registered, this setup is generally done by the administrators. Admins will be first prompted to provide client details like Client ID, Client Secret, Auth URL, Token URL and Scopes. Refer the screenshot here, once the setup is done then only other users will be able to use it.

After saving the details, if they are correct then we will redirect and open popup requesting grant from the target application.

service String name of the service
module String name of the module
callback function user handler function

Example :

VTAP.OAuth.Authorize("3PService", "Contacts", (error, success) => {

});

VTAP.OAuth.IsAuthorized

Checks if a service is already authorized or not.

Example :

VTAP.OAuth.IsAuthorized("3PService", "Contacts", (response) => {
    if(response.authorized) {
    //user has authorized
    }
});

VTAP.OAuth.Revoke

Removes oauth tokens which has earlier obtained using Authorize api.

Example :

VTAP.OAuth.Revoke("3PService", "Contacts", (response) => {

});

VTAP.OAuth.ShowAuthClientDetailsPopup

Show oauth client app details which was earlier saved by admins. This should generally be used when admins wants to change client secret or scopes.

Example :

VTAP.OAuth.ShowAuthClientDetailsPopup("3PService", "Contacts");

VTAP.OAuth.DeleteAuthClientDetails

Revokes a oauth client app details which was earlier saved by admins.

Example :

VTAP.OAuth.DeleteAuthClientDetails("3PService", "Contacts").then((success){
    //success   
}, (error) => {
    //failure
});


VTAP.Field

This object exposes api's that will help you add custom behaviour on the Vtiger Fields. Fields are pieces of information which make a CRM record. For example Contact first name, last name, Company Name are considered as field in Vtiger.

VTAP.Field.RegisterValidator

This API lets you register custom field validation. You may want to avoid your agents making mistakes of filling incorrect values in the CRM. For example, VAT number should be strictly 16 character length, or tracking shipping delivery code should

fieldname String name of the field where custom validation should be applied
module String name of the module
handlerFunction function the function will have the logic to decide the validation rules, and returns true/false
errorHandlerfunctionreturns the error message that should be shown when validation fails.
//Adding validation for Contact's First name to be not empty. 
VTAP.Field.RegisterValidator('firstname','Contacts', (value) => { 
    if(value == '') {
        return false;
    }
}, (error) => { 
    return "First name cannot be empty"; 
});

//Adding validation for Contact's Mobile number cannot be less than 10 digit 
VTAP.Field.RegisterValidator('mobile','Contacts', (value) => { 
    if(value.length < 10) {
        return false;
    }
}, (error) => { 
    return "Mobile should be atleast 10 digits!!"; 
});

VTAP.Field.RegisterValidatorForType

This API will enable you to add validation for field type. For instance if you want to add same validation to all the email fields, or phone fields or url fields then you need to use this field. Another example is you want to avoid adding any email address in any of the email field with gmail.com/outlook.com in Contacts module. The definition of the API is same as RegisterValidator, except the first argument is field type instead of field name.

fieldtype String field type like 'email', 'phone', 'url', 'multicurrency', 'picklist', 'text', 'boolean', 'percentage', 'richtext', 'image', 'file', 'metricpicklist', 'grid', 'datetime', 'radio', 'anniversary', 'owner'
module String name of the module
handlerFunction function the function will have the logic to decide the validation rules, and returns true/false
errorHandlerfunctionreturns the error message that should be shown when validation fails.
//Adding validation for Contact's First name to be not empty. 
VTAP.Field.RegisterValidatorForType('email','Contacts', (value) => { 
    if(value != '' && value.indexOf('gmail.com') !== -1) {
        return false;
    }
}, (error) => { 
    return "We do not accept gmail addresses"; 
});

//Adding validation for Contact's Mobile number cannot be less than 10 digit 
VTAP.Field.RegisterValidatorForType('phone','Contacts', (value) => { 
    if(value.length < 10) {
        return false;
    }
}, (fieldLabel) => { 
    return fieldLabel+" should be atleast 10 digits!!"; 
});


Component types

Type Description Example
LIST_ADD_VIEWTYPE Add custom views like kanban, calendar view in list view. VTAP.Component.Register('LIST_ADD_VIEWTYPE', {name : 'ChartView', icon : 'fa-barchart', 'label' : Chart View'});

Note : Once added it will search for a component named “ChartView”, you need to register component Vtiger_Component_ChartView = VTAP.Component.Core.extend({ });

To understand the typical structure of a vtiger component click [here](https://extend.vtiger.com/vtap/documentation/wikis/VTAP-Runtime#vtapcomponentcore)
LIST_ADVANCED_SETTING In the List page we show settings icons next to navigation for admins, your custom option will be available here. Generally used to store extension settings. VTAP.Component.Register('LIST_ADVANCED_SETTING', {name : 'Workflows', clickHandler : () => { } });
LIST_BASIC_BUTTON Add a custom button in the list page next to the Add Record button. VTAP.Component.Register('LIST_BASIC_BUTTON', {label:'Custom', icon:'fa fa-pencil', varient:'btn btn-primary', clickHandler: () => { } }, '', {module:'Contacts'});

For icon you can use any font awesome icon class, and for varient you can use any bootstrap button class. clickHandler is a function.
LIST_ROW_BASIC_ACTION Every list row has actions on the right side, your component can add any element but recommended is an icon. VTAP.Component.Register('LIST_ROW_BASIC_ACTION', {icon:'fa fa-plus',label:'Send email',clickHandler: () => {}}, '', {module:'Contacts'});
LIST_ROW_SECONDARY_ACTION This will add a component to the left side of every row in the list page. VTAP.Component.Register('LIST_ROW_SECONDARY_ACTION', {icon:'fa fa-plus',label:'Send email',clickHandler: () => {}}, '', {module:'Contacts'});
LIST_MASS_ACTION It will add an icon in the list view mass actions. VTAP.Component.Register('LIST_MASS_ACTION', {icon:'fa-pencil',name:'Edit',clickHandler:()=>{},showHandler:()=>{}}, false, {module:'Contacts'});
GLOBAL_ACTION It will add a component at the top of the page where search and other actions are available. These actions will be available in all the pages. VTAP.Component.Register('GLOBAL_ACTION', {icon:'fa fa-plus',label:'Send email',clickHandler: () => {}}, '', FILTER);
DETAIL_ONEVIEW_WIDGET It will let you add widget in One view related tab of the detail page VTAP.Component.Register('DETAIL_ONEVIEW_WIDGET', {}, VTAP.Component.Load('NAME','MODULE'), FILTER);
DETAIL_MORE_ACTION_ITEM Add custom actions from 3 dots on the top right side of the detail page. VTAP.Component.Register('DETAIL_MORE_ACTION_ITEM', {icon:'fa fa-plus',label:'Send email',clickHandler: () => {}}, '', FILTER);
DETAIL_BASIC_BUTTON Add a button in detail view header where other actions are available. VTAP.Component.Register('DETAIL_BASIC_BUTTON', {label:'Custom', icon:'fa fa-pencil', varient:'btn btn-primary', clickHandler: () => { } }, '', FILTER);
DETAIL_ACTION_ICON Add an actionable icon in more actions(3 dots) in the detail page. VTAP.Component.Register('DETAIL_ACTION_ICON', {name:'',icon:'',showHandler:() => {},clickHandler: () => {}}, '', FILTER);
DETAIL_HEADER_WIDGET Add component in the detail page header. VTAP.Component.Register('DETAIL_HEADER_WIDGET', {}, VTAP.Component.Load("COMPONENT_NAME","MODULENAME"), FILTER);
DETAIL_RELATED_RECORD_ACTION Add a custom action for records appearing in the related list. VTAP.Component.Register('DETAIL_RELATED_RECORD_ACTION', {icon:'fa fa-plus',label:'Send email',clickHandler: () => {}}, '', FILTER);
DETAIL_MORE_ACTION_ACTIVITY_ITEM Add custom action under the detail page with more actions, inside “Reach out now” section. VTAP.Component.Register('DETAIL_MORE_ACTION_ACTIVITY_ITEM', {icon:'fa fa-plus',label:'Send email',clickHandler: () => {}}, '', FILTER);
DETAIL_SUMMARY_WIDGET Add custom widget in detail page summary view. VTAP.Component.Register('DETAIL_SUMMARY_WIDGET', {}, VTAP.Component.Load('NAME','MODULE'), FILTER);

Event Types

List of UI Events triggered from core / custom components on different pages.

Type Description Example
DETAIL_PREVIEW_SHOWN When record detail preview popup is shown. VTAP.Event.Register('DETAIL_PREVIEW_SHOWN', (data) => { });
DETAIL_PREVIEW_HIDDEN When record detail preview popup is hidden. VTAP.Event.Register('DETAIL_PREVIEW_HIDDEN', (data) => { });
DETAIL_ALLFIELDS_SHOWN When record detail page all field popup is shown. See here. VTAP.Event.Register('DETAIL_ALLFIELDS_SHOWN', (data) => { });
DETAIL_ALLFIELDS_HIDDEN When record detail page all fields popup is hidden. VTAP.Event.Register('DETAIL_ALLFIELDS_HIDDEN', (data) => { });
EDIT_MODAL_SHOWN When record edit page is shown. VTAP.Event.Register('EDIT_MODAL_SHOWN', (data) => { });
EDIT_MODAL_HIDDEN When record edit page is hidden. VTAP.Event.Register('EDIT_MODAL_HIDDEN', (data) => { });
CREATE_MODAL_SHOWN When record create page is shown. VTAP.Event.Register('CREATE_MODAL_SHOWN', (data) => { });
RECORD_CREATED When record is created from any where inside the crm. VTAP.Event.Register('RECORD_CREATED', (module, record) => { });
RECORD_UPDATED When record is updated from any where inside the crm. VTAP.Event.Register('RECORD_UPDATED', (module, record) => { });
RECORD_SAVED When you want to listen to both record created/updated from any where inside the crm. VTAP.Event.Register('RECORD_SAVED', (module, record) => { });
RECORD_DELETED This event is triggered after record is deleted. This is triggered from detail page. VTAP.Event.Register('RECORD_DELETED', (module, id) => { });
MASS_RECORD_DELETED This event is triggered after multiple records are deleted from list page. VTAP.Event.Register('MASS_RECORD_DELETED', (module, ids) => { });
ONE_VIEW_RELOAD You can refresh one view related lists by triggering this event. This should be done after you add/update record from one view section. VTAP.Event.Trigger('ONE_VIEW_RELOAD');