Adding Custom Related Lists
How Can I...
Each record created by your subscribers in your vertical CRM has the option to associate other records to it. For example, a Contact has notes, activities, potentials, products, attachments, etc. associated to it. These are called Related Lists and are provided by default but you can also have custom related list added to a record. Custom Related Lists helps your customer view data collected from other sources. You can add new related list or customize the existing related list.
Adding a Related List
Create Custom Functions
In addition to the pre-defined related lists, you can also create new related list by writing your own custom functions using DELUGE script. See Also Deluge Scripts, Functions
Deluge Script
Deluge or Data Enriched Language for the Universal Grid Environment as we call it, is an online scripting language integrated with Zoho Creator. It enables users to add logic to the application, incrementally, making it more powerful and robust. The entire database layer is abstracted and you will only speak in terms of forms and fields, while scripting in Deluge. Read more
Custom Function
A function is a set of statements grouped together under a name and can be invoked from anywhere within a program. Deluge Scripting supports Functions, using which we can structure the deluge script, in a more modular way, accessing all the potential that structured programming can offer. Related functions can also be grouped under a common category based on their purpose, called names pace, which helps in easy maintenance. Functions can be invoked from form/field action scripts or on selected records in a view. Read more
To create a custom function
- Log in to Zoho Developer Console and click Vertical Solutions
- In the Vertical CRM page, select the application in which the related list has to be edited and click Edit.
- Click Components in the left pane and select Related List tab at the top of the page and click Custom.
- In the Add Related List page, click Add Related List.
- In the Workflow Custom Related List page, do the following:
- Enter a name for the function in the Function Name text box.
- Select the module in which the related list has to be added.
- In the Deluge script editor, code your own logic and click Save and Close.
Example
Consider a Garage CRM that has a module named Vehicles. Vehicles has a related list named Similar Customers which lists customers who have the same vehicle model as the parent record.
vehicleId = vehicle.get("Vehicles.ID");
vehicleRecord = zoho.crm.getRecordById("Vehicles",vehicleId.toLong());
vehicleName = vehicleRecord.get("Car_Model");
crmResp = zoho.crm.searchRecords("Vehicles","(Car_Model:equals:" + vehicleName + ")",1,10);
responseXML = "";
rowVal = 0;
if(crmResp.size() > 1)
{
responseXML = responseXML + "<record>";
for each vehicle in crmResp
{
data = vehicle.get("Vehicle_Contact");
contactId = data.get("id");
contactRecord = zoho.crm.getRecordById("Contacts",contactId);
contactPhone = contactRecord.get("Phone");
contactName = contactRecord.get("Full_Name");
responseXML = responseXML + "<row cnt='" + rowVal + "'><FL val='Customer Name'>" + contactName + "</FL><FL val='Customer Phone'>" + contactPhone + "</FL></row>";
rowVal = rowVal + 1;
}
responseXML = responseXML + "</record>";
}
else
{
responseXML = responseXML + "<error>=><message>No other customer has a vehicle with the same model.</message></error>";
}
return responseXML;
Use the format below for constructing the related list:
<record>
<row no="0">
<FL val="Name1">value1</FL>
<FL val="Name2">value2</FL>
</row>
<row no="1">
<FL val="Name1">value1</FL>
<FL val="Name2">value2</FL>
</row>
</record>
Error/Exception messages can be displayed in the custom related list by using the tags mentioned below:
<error>
<message>Your error message goes here !!!</message>
</error>
The custom related list will be displayed as depicted below:
Refer this page for details of how to create a custom related list using a widget.
Edit a Custom Related List
To edit a related list
- Log in to Zoho Developer Console and click Vertical Solutions
- In the Vertical CRM page, select the application in which the related list has to be edited and click Edit.
- Click Components in the left pane and select Related List tab at the top of the page and click Custom.
- Select the module which has the related list to be edited, from the Module drop-down list box.
Now a list of related list created for this particular module gets listed below. - Move the mouse pointer to the related list that you want to edit and click the Edit icon.
- In the Edit Custom Related List popupbox, you can do the following:
- Modify the name of the Related List.
- In the Deluge Script Editor, edit the logic of the custom function.
- Click Save.
Delete a Custom Related List
To delete a related list
- Log in to Zoho Developer Console and click Vertical Solutions
- In the Vertical CRM page, select the application in which the related list has to be edited and click Edit.
- Click Components in the left pane and select Related List tab at the top of the page and click Custom.
- In the Add Related List page, select the module which has the related list to be deleted, from the Module drop-down list box.
Now a list of related list created for this particular module gets listed below. - Move the mouse pointer to the related list that you want to edit and click the Delete icon.
In the confirmation Pop up click OK.