Automation#18: Automatically Fetch Values from Contacts to the Tickets Module

Automation#18: Automatically Fetch Values from Contacts to the Tickets Module



Hello Everyone,

Welcome to this week's edition, where you can seamlessly sync fields from the Contacts to the Tickets module. For efficient business operations, it's crucial to have details mapped across different modules.
Zylker Secure offers antivirus services with various pricing plans for its customers. Each plan purchased is stored in the Customer module. Every time a customer submitted a query, it was challenging to refer to the plan and process the requirements accordingly. Zylker Secure solved this by mapping pricing plan data from the customer record to the tickets module. This automatic sync streamlined their business operations. Let's see how to implement this automation in your Desk portal.

Prerequisites
1. Create a custom field in the Ticket and Contact layout.
    1.1 Go to Setup >> Customization >> Layouts and Fields.
    1.2 Choose the required Department and select the Ticket layout under it.
    1.3 Create a
custom field in the Ticket layout. Click Save.
    1.4 In Layouts, choose Contacts from the drop-down list for the same department.
    1.5 Click on the Contact layout and create the same custom field type in the Contacts layout.
          Click Save.  
Note: The field type in the Contacts layout must match the field type in the Tickets layout. For example, if one layout has a single line field, the other must also have a single line field. Similarly, if one has a picklist field, the other must have a matching custom picklist field.

Create a Workflow Rule
1. Go to Setup, choose Workflows under Automation.
2. Under Workflows, click Rules >> Create Rule.
In the Basic Information section,
3. Select Tickets from the drop-down menu under Module.
4. Enter a Rule Name and Description for the rule.
5. If you want to activate the rule right away, select the Active checkbox. Else, create the rule and activate it later.
6. Click Next.
In the Execute on section, follow these steps:
7. Select the Create checkbox to execute this rule every time a new ticket is created.  
8. Click Next.
9. Leave the Criteria blank and click Next.
10. In the Actions section, click the + icon and select New next to Custom Functions.
11. Enter a Name and Description for the custom function.
12. In the script window, insert the Custom Function given below:
  1. orgId = "6*********0"; // replace orgId
  2. ticketAPIName = "cf_name"; // replace API name of the custom field in Tickets layout
  3. contactAPIName = "cf_name"; // replace API name of the custom field in Contacts layout
  4. getContact = zoho.desk.getRecordById(orgId,"contacts",ContactID);
  5. customFields = getContact.getJSON("cf");
  6. updateTicket = zoho.desk.update(orgId,"tickets",TicketID,{"cf":{ticketAPIName:customFields.getJSON(contactAPIName)}});
  7. info updateTicket;
Note: In line 1, place your OrgId. To access your OrgId, go to Setup >> Developer Space >> API.
In line 2, replace the value with the API name of the custom field created in the Tickets layout.
In line 3, replace the value with the API name of the custom field created in the Contacts layout.
 
To access API name of the custom field, Go to Setup>>Customization>>Layouts and Fields >> Fields List. Select the module, and you can find the API name of the custom field created.
13. Click Edit Arguments and include the argument mapping as below: 
13.1. In the Name field type ContactID, and from the Value drop-down list select Contact Id under Contact Sections.
13.2. In the Name field type TicketID, and from the Value drop-down list select Ticket Id under Ticket Sections.
14. Click Save to save the custom function.
15. Click Save again to save the workflow.

Implementation
When a ticket is created, the custom field in the Tickets layout is updated automatically by fetching the value from the custom field in the Contacts layout.
 
See you next week with another custom function coming your way!


      • Sticky Posts

      • Zoho Desk Virtual Meetup: US Central, October 5 - 7, 2021

        After the interactive Virtual Meetups in the other regions, we are starting with the US Central and Midwest regions from October 5 to October 7, 2021. The dates for other regions will be announced soon.  At this event, we will explore the topics which
      • Register for Zoho Desk Beta Community

        With the start of the year, we have decided to take a small step in making the life of our customers a little easier. We now have easy access to all our upcoming features and a faster way to request for beta access. We open betas for some of our features
      • Ask the Experts 10: A 5-hour online Q&A on Zoho Desk Best Practices

        Welcome to Zoho Desk's Ask the Experts session! This is a monthly discussion on our  forums; wherein a panel of experts will take on questions  specific to topics related to Zoho Desk. The panel will be available for a 5-hour period and will answer any questions posted here.   Let's begin the year learning some best practices from our experts. In this month's ATE we are opening the floor to questions on how to use Zoho Desk the best way.  If you have a business use case but not sure if Workflow is
      • Share your Zoho Desk story with us!

        Tell us how you use Zoho Desk for your business and inspire others with your story. Be it a simple workflow rule that helps you navigate complex processes or a macro that saves your team a lot of time; share it here and help the community learn and grow with shared knowledge. 
      • Ask the Experts 7: A 5-hour online Q&A on Telephony and Call Module

        Welcome to Ask the Experts session! This is a monthly discussion in forums; each session, a panel of experts will take questions on specific topics related to Zoho Desk. The panel will be available for a 5-hour period and answer any questions posted here. In this month's Ask the Experts, we will take questions on everything related to Telephony and the Call Module in Zoho Desk. We will discuss the following aspects:  Integration with different Telephony vendors Routing calls to agents Converting