Get Started

Tailor-Made Itineraries

Tour & Cruise Itineraries

FIT Package Itineraries

Role Guides

Kaptio Admin

Supplier Contracting

Product Design/Build

Product Content

Training Manager

Data Experts

Developers

Kaptio Platform Architecture

Architecture Overview

Development Guidelines

Functional Decomposition

Platform FAQ

New to Salesforce?

Security & Compliance

Manage your Environments

Data Import & Export

Global Platform Setup

Getting Started with Core Configuration

Manage Global Settings

Configure Channels

Managing Users, Roles & Access

Understanding Your Sample Data

PIM: Supplier Contracting

Managing Suppliers

Setup Locations

Managing Services

Configure Prices

Bulk Import Service Data

Manage Inventory

Promotion & Discount Setup

PIM: Tour & Package Design

Getting Started with Packages

Understanding Departure Types

Manage Package Pricing

Setup Package Content

Configure Package Defaulting

CRM Module

Customizing Kaptio Travel

Manage Account Record Types

Setup Trip & Itinerary Workflow

Manage Salesforce Features

CONNECT: Land & Air Connectivity

Getting Started with Connectivity

PNR Import Setup & Usage

Integrating Amadeus

Hotel Connectivity Setup & Usage

DOCS Module

Getting Started: Content

Managing Content & Media

Setup Document Stages

Setup Templates

Building Custom Content Components

Bulk Import Content Data

Using the Document Starter Kit

Using the ATOL Certificate Starter Kit

Personalizing Documents

Generating Documents

Customer Access to Documents

Email Setup & Usage

Advanced Sample Email Template

In this guide, we will walk you through the process of building custom content components for our document templates.

How to Create Custom Content Components

Custom content components provide you with more flexibility when designing your document templates. Learn how to setup these components here.

Code Sample & Step-by-step Guide

Step 1: Determine the Component's Purpose and Functionality

Before you start building a custom content component, it's important to determine its purpose and functionality. What information or data should it display? What actions should it enable? What kind of visual design should it have? Answering these questions will help you create a component that is both useful and visually appealing.

Step 2: Create the Visualforce Page

The first step in building a custom content component is creating the Visualforce page that will display your component. This page should contain the HTML and CSS needed to render your component's visual design, as well as the Apex code that will retrieve and manipulate the data needed to display your component's content.

Step 3: Create the Apex Controller

Next, you'll need to create an Apex controller that will handle the logic needed to retrieve and manipulate data for your component. This controller should implement the KaptioTravel.IComponentHandler interface and define the getBody() and isEmpty() methods.

Step 4: Test Your Component

Once you've created your Visualforce page and Apex controller, it's time to test your component. You can do this by creating a new document template in Kaptio and adding your component to it. Make sure to test your component thoroughly and fix any bugs or issues you encounter.

Step 5: Add Your Component to a Document Template

Once you've tested and refined your component, it's time to add it to a document template. To do this, simply edit the template and drag your component into the desired location. Make sure to save your changes and test your template to ensure that your component is working as intended.

Conclusion

Building custom content components can be a challenging but rewarding process. By following the steps outlined in this guide, you'll be able to create components that are both useful and visually appealing, and that help to enhance the overall quality of our document templates. Good luck!

Custom content components provide you with more flexibility when designing your document templates. Learn how to create these components here.

Code Sample

The following is an example ofa simple custom component that shows payment information using information from the Itinerary.

Please note: The context of custom content component is always the Itinerary. You cannot determine which stage type of the document they are within.

Apex Class

/**
* @author Vadim
* @date 2016/08/01
* @description Sample class for a custom content components
*/

global without sharing class KTD_CustomContentController implements KaptioTravel.IComponentHandler {

    @description A KaptioTravel__Itinerary__c record
    public KaptioTravel__Itinerary__c itinerary { get; private set; }

    @description Id of context Itinerary. Used to populate the itinerary variable.
    private Id itineraryId { get; set; }

    global KTD_CustomContentController() {

        if(ApexPages.currentPage() != null){
            this.itineraryId = ApexPages.currentPage().getParameters().get('id');
            if(Schema.KaptioTravel__Itinerary__c.SObjectType == this.itineraryId.getSobjectType()) {
                init(this.itineraryId);
            }
        }
    }

    public void init(Id p_id) {

        try {
            this.itineraryId = p_id;

            this.itinerary = [
                SELECT Id, Name, CurrencyIsoCode, KaptioTravel__Name_on_booking__c, KaptioTravel__VersionNumber__c, Owner.Name, KaptioTravel__Group_Size__c,
                KaptioTravel__Amount_Per_Person__c, KaptioTravel__Itinerary_Amount__c, KaptioTravel__Transaction_Amount__c, KaptioTravel__Outstanding__c,
                KaptioTravel__FinalPaymentExpectedDate__c, KaptioTravel__BookingNumber__c, KaptioTravel__Channel__r.KaptioTravel__Brand__r.Name,
                KaptioTravel__Channel__r.KaptioTravel__ChannelCode__c, KaptioTravel__Primary_Contact__r.Account.BillingCountry,
                KaptioTravel__Primary_Contact__r.Account.BillingState, KaptioTravel__Primary_Contact__r.Account.BillingCity,
                KaptioTravel__Primary_Contact__r.Account.BillingPostalCode, KaptioTravel__Primary_Contact__r.Account.BillingStreet,
                KaptioTravel__Primary_Contact__r.Account.BillingAddress, KaptioTravel__ResellerCommissionTotal__c, KaptioTravel__ResellerCommissionTaxTotal__c,
                FROM KaptioTravel__Itinerary__c
                WHERE Id = :this.itineraryId
            ];

        } catch (Exception e) {
            System.debug('KTD_CustomContentController ERROR: ' + e.getMessage() + '; Stack Trace: ' + e.getStackTraceString());
        }
    }

     /**
    * @description Required function for the IComponentHandler interface. Defines the VF page used as output for the component. Defined here to allow the content engine to create a html string from the components output
    * @return String HTML output generated from the VF page and data from this controller
    **/
    public String getBody() {
        PageReference pref = Page.KTD_CustomComponent;
        pref.getParameters().put('id', this.itineraryId);
        Blob content = System.Test.isRunningTest() ? Blob.valueOf('Test') : pref.getContent();

        return content.toString();
    }

    /**
    * @description Required function for the IComponentHandler interface. If returns true, then the component will not render.
    * @return Boolean
    **/
    public Boolean isEmpty(){
        return false;
    }

}

Visualforce page