Enhancements to VTAP JavaScript APIs

We are excited to announce significant enhancements to VTAP JavaScript APIs, designed to empower developers and partners working with Vtiger CRM.

These improvements focus on enhancing the flexibility and functionality of the platform, particularly within the Events module and the RelatedRecords API. Below, we outline the key updates that enable you to create many dynamic and responsive CRM solutions.

Enhancement 1: Support for Extra Fields in the RelatedRecords API

We have extended the VTAP RelatedRecords API to include support for the extrafields parameter, enabling you to retrieve additional fields beyond the default ones provided. This enhancement offers more flexibility when working with related records, allowing for richer data interactions.

VTAP.Detail.RelatedRecords

This API fetches related records for a given module. By default, it includes fields that are enabled for Quick Create, Header, etc. With the new extrafields parameter, you can now specify additional fields to be included in the response, providing greater insight into related data.

Example Use Case: Assume you are working with the Contacts module and want to retrieve related Case records that include fields such as casechannel and slastatus, which are not part of the default response. You can now easily include these fields in your API request:


  

VTAP.Detail.RelatedRecords("Cases", { 'extrafields': ['casechannel', 'slastatus'] })

    .then((case_records) => {

        // Process the retrieved case records with extra fields

    });


  

VTAP.Detail.RelatedRecords("Cases", { 'extrafields': ['casechannel', 'slastatus'] })

    .then((case_records) => {

        // Process the retrieved case records with extra fields

    });

 

Enhancement 2: Label Column Support in the RelatedRecords API

In addition to the above enhancements, we have also added support for the label column in the VTAP RelatedRecords API. This improvement allows you to include the record name (label) in the API response, making it easier to identify and work with related records.

VTAP.Detail.Record

Previously, the RelatedRecords API did not support the inclusion of the label column, that contains the name of the record. Now, by using the extrafields parameter, you can request this label in your API calls.

Example Use Case: When fetching related Case records, you might want to include the record's name for easy identification. Simply pass label as an additional field:

 

Enhancement 2: Label Column Support in the RelatedRecords API

In addition to the above enhancements, we have also added support for the label column in the VTAP RelatedRecords API. This improvement allows you to include the record name (label) in the API response, making it easier to identify and work with related records.

VTAP.Detail.Record

Previously, the RelatedRecords API did not support the inclusion of the label column, that contains the name of the record. Now, by using the extrafields parameter, you can request this label in your API calls.

Example Use Case: When fetching related Case records, you might want to include the record's name for easy identification. Simply pass label as an additional field:


  

VTAP.Detail.RelatedRecords("Cases", { 'extrafields': ['label'] })

    .then((case_records) => {

        // The response now includes the label (name) of each case

    });


  

VTAP.Detail.RelatedRecords("Cases", { 'extrafields': ['label'] })

    .then((case_records) => {

        // The response now includes the label (name) of each case

    });

 

These enhancements are part of our ongoing commitment to provide you with powerful tools for building dynamic, enterprise-grade applications on the Vtiger CRM platform. We encourage you to explore these new features and integrate them into your projects to enhance the overall user experience.

Stay tuned for more updates, and happy coding!

 

These enhancements are part of our ongoing commitment to provide you with powerful tools for building dynamic, enterprise-grade applications on the Vtiger CRM platform. We encourage you to explore these new features and integrate them into your projects to enhance the overall user experience.

Stay tuned for more updates, and happy coding!

 
 
 

VTAP Customer Use Case

 
 

One customer requested to not show the Invitees block in the Events module for custom-type events other than Call and Meeting. It was taking up space on the screen with no use for custom-type events used for internal events.

Enhanced Event Handling in the Events Module

The VTAP Event API now includes the ability to control the visibility of the Invitees block within the Events module. This enhancement allows for precise control over the user interface, tailored to the specific needs of your application.

  • VTAP.Event.Register: This function allows you to register client-side events and receive callbacks when these events occur in the user interface. A comprehensive list of supported events is available here.
  • VTAP.Event.Trigger: This function forces the execution of events provided by the Vtiger UI. We’ve introduced two new events for showing and hiding the Invitees block in the Events module:
  • EVENT_SHOW_INVITEES: Triggers the display of the Invitees block.
  • EVENT_HIDE_INVITEES: Hides the Invitees block.

You can leverage these events to dynamically control the visibility based on user input. For other activity types, you can hide the Invitees block to streamline the user experience.

Create a VTAP script for the Events module with the name Invitees and copy the below function to hide the Invitees block for Activity Type other than Meeting and Call:

 

One customer requested to not show the Invitees block in the Events module for custom-type events other than Call and Meeting. It was taking up space on the screen with no use for custom-type events used for internal events.

Enhanced Event Handling in the Events Module

The VTAP Event API now includes the ability to control the visibility of the Invitees block within the Events module. This enhancement allows for precise control over the user interface, tailored to the specific needs of your application.

  • VTAP.Event.Register: This function allows you to register client-side events and receive callbacks when these events occur in the user interface. A comprehensive list of supported events is available here.
  • VTAP.Event.Trigger: This function forces the execution of events provided by the Vtiger UI. We’ve introduced two new events for showing and hiding the Invitees block in the Events module:
  • EVENT_SHOW_INVITEES: Triggers the display of the Invitees block.
  • EVENT_HIDE_INVITEES: Hides the Invitees block.

You can leverage these events to dynamically control the visibility based on user input. For other activity types, you can hide the Invitees block to streamline the user experience.

Create a VTAP script for the Events module with the name Invitees and copy the below function to hide the Invitees block for Activity Type other than Meeting and Call:


  

var Events_Component_Invitess = VTAP.Component.Core.extend({

    mounted() {

        VTAP.Event.Register("CREATE_MODAL_SHOWN", (data) => { this.observeEventsFormActivityType(data); });

        VTAP.Event.Register("EDIT_MODAL_SHOWN", (data) => { this.observeEventsFormActivityType(data); });

    },

    methods : {

        observeEventsFormActivityType(data) {

            if (data.module == "Events") {

                setTimeout(() => {

                    var element = jQuery('select[name="activitytype"]');

                    if (element.length) {

                        this.handleEventsFormActivityType(element.get(0).value);

                        element.on('change', () => { this.handleEventsFormActivityType(element.get(0).value); }); /* changes */

                    } else {

                        if(data && data.record) {

                            VTAP.Api.Get('records', {

                                'module': 'Events',

                                'id': data.record

                            }, (error, response) => {

                                this.handleEventsFormActivityType(response.activitytype);

                            });

                        }

                    }

                }, 500);

            }

        },

        handleEventsFormActivityType(activityType) {

            if (activityType == "Call" || activityType == "Meeting") {

                VTAP.Event.Trigger("EVENT_SHOW_INVITEES");

            } else {

                VTAP.Event.Trigger("EVENT_HIDE_INVITEES");

            }

        }

    }

});


  

var Events_Component_Invitess = VTAP.Component.Core.extend({

    mounted() {

        VTAP.Event.Register("CREATE_MODAL_SHOWN", (data) => { this.observeEventsFormActivityType(data); });

        VTAP.Event.Register("EDIT_MODAL_SHOWN", (data) => { this.observeEventsFormActivityType(data); });

    },

    methods : {

        observeEventsFormActivityType(data) {

            if (data.module == "Events") {

                setTimeout(() => {

                    var element = jQuery('select[name="activitytype"]');

                    if (element.length) {

                        this.handleEventsFormActivityType(element.get(0).value);

                        element.on('change', () => { this.handleEventsFormActivityType(element.get(0).value); }); /* changes */

                    } else {

                        if(data && data.record) {

                            VTAP.Api.Get('records', {

                                'module': 'Events',

                                'id': data.record

                            }, (error, response) => {

                                this.handleEventsFormActivityType(response.activitytype);

                            });

                        }

                    }

                }, 500);

            }

        },

        handleEventsFormActivityType(activityType) {

            if (activityType == "Call" || activityType == "Meeting") {

                VTAP.Event.Trigger("EVENT_SHOW_INVITEES");

            } else {

                VTAP.Event.Trigger("EVENT_HIDE_INVITEES");

            }

        }

    }

});

 
 

Sign up to receive the latest updates!