How to Create TimeLine Event in Sugar Using Your Own Application

How to Create TimeLine Event in Sugar Using Your Own ApplicationAuthor: Victor Zhubrzhytskyy, CTO

Introduction

Sugar provides wide possibilities for access to own data through own API.

In the example, we are going to see how to create TimeLine Viewer events not from Sugar, but from external application using standard call from REST API.

Description

Let’s simulate the case when the event occurred in the external application and there is no information about it in Sugar. For example, in the banking system there occurred an event “The customer delayed the payment for a loan” and the information about it is important to a manager who works with this customer in Sugar. However, the CRM contains only information about the customer, and information on a loan, loan payments etc. is stored and processed in the banking system.

Tools for simulating

Postman application was used to implement the example. Further in the example, the syntax {{variable}} means that a variable of Postman environment is used.

You may find the example here.

In the example, you may choose the option to format REST requests for various programming languages.
How to Create TimeLine Event in Sugar Using Your Own Application

Order of steps to implement the example

In the example, we’ll find a customer in the CRM and will create a TimeLine event on outstanding loan payment in relation to the found customer. Thus, the information on the event from the external (banking) system regarding the client will be available in Sugar.

Step 1. Authentication

It is a standard step. You must pass authentication and get an access token. For more details, please see Sugar documentation.

The access token will be used in steps 2 and 3.

Step 2. Customer search on Sugar
To search a customer, use GET method for Contacts (documentation on /<module> GET)

It is the perfect and easiest search option when in the system where the event creation is initiated the key (ID) of the record being searched is stored.

In our example, we are searching a customer by e-mail and we use ID of the found customer in Step 3.
How to Create TimeLine Event in Sugar Using Your Own Application Where {{contactEmail}} is e-mail by which we are searching a customer.

Step 3. Creating TimeLine record

To create TimeLine record, execute POST for PX_TimeLine module.
How to Create TimeLine Event in Sugar Using Your Own Application

Specify the following parameters in the request body:

name_html* – name of the event. You may use html formatting. Mandatory parameter.

action_date* – date of the event. The date format is described here. Mandatory parameter.

event_id – ID of TLV event. PX_TimelineEvents is the reference of TLV events. In this example, we use one of the events from the reference, which is “Payment is overdue”.

parent_type – module name in Sugar, in the context of which TimeLine record will be displayed. In the example, it is Contacts, as it is the contact details that we searched by e-mail.

parent_id – ID of the contact found by e-mail.

context – Description of the event details as: Parameter – value. Use JSON.

Display of created TimeLine record in Sugar

When step 3 is completed, TimeLine record will be created in Sugar as shown below.
How to Create TimeLine Event in Sugar Using Your Own Application
Details of TimeLine record in Sugar:
How to Create TimeLine Event in Sugar Using Your Own Application
Want to try TimeLine Viewer? Leave us a request and we’ll be happy to give you access to the demo-environment.

Leave a Reply

Your email address will not be published. Required fields are marked *