Hello Biginners,
In our previous forum post, we explored
install and uninstall actions and learned how to trigger custom logic the moment a topping is added or removed from an organization. In this post, we'll look at how to automate actions during regular, everyday use. To achieve this, we'll explore two important features in the Bigin Developer Console: schedules and workflow functions.
Together, schedules and workflow functions allow us to build toppings that respond to record events in real time and monitor conditions over time. To understand how these features work, let's walk through a common requirement in a customer support pipeline.
The challenge: Avoiding communication gaps and idle tickets
In a customer support pipeline, clear communication and timely follow-ups are crucial. A ticket represents a customer request, and delay affects customer trust.
There are two common scenarios that help make managing support tickets smoother for teams:
- When a ticket is created, sending an acknowledgment email to the customer and notifying the assigned ticket owner with customized content ensures clear and immediate communication.
- After a ticket is assigned, setting up a structured reminder system for tickets that remain idle in the same stage helps prevent them from being overlooked and ensures timely follow-ups.
We can build a topping to handle these scenarios.
Overview of the topping
We'll build a follow-up support automation topping that handles both real-time communication and time-based monitoring.
This topping will include:
- A workflow function that is triggered when a ticket is created. It sends an acknowledgement email to the customer saying that their request has been received and also sends a notification to the ticket owner about the new ticket.
- A scheduled function that runs 24 hours after a ticket is created. If the ticket remains open beyond 24 hours, the topping sends a reminder email to the ticket owner every 12 hours until the ticket is closed, ensuring timely follow-up.
We can achieve this by building a topping using the features available in the Bigin Developer Console, like workflows, schedules, and functions.
Setting up the topping
A topping needs to be created using the Bigin Developer Center. For detailed instructions on creating a topping, refer to
this post for a tutorial.
Once you've created a topping and accessed the Bigin Developer Console, the next step is to create the required service connection.
Since the topping needs to have access to the Bigin pipelines and ticket owner details, you need to create a default service connection for Bigin with the scopes ZohoBigin.modules.Pipelines.ALL and ZohoBigin.org.ALL.
After creating the Bigin connection, you can proceed with the first part of the topping implementation, which handles newly created tickets.
Creating a workflow rule for new tickets
To configure the workflow, navigate to the Automate section in the left panel of the Bigin Developer Console and select Workflow. Create a new workflow rule in the Pipelines module.
In the workflow configuration, set the rule to execute based on a Record action and choose Create so that it triggers whenever a new ticket is created. Under conditions, select Pipelines matching certain conditions and define the condition as Pipeline is Customer Support Standard. This ensures that the rule applies only to tickets created in that specific pipeline. Under Instant Actions, you need to associate the workflow with a custom function so that it executes immediately when the workflow is triggered.
This function will fetch the ticket details, send an acknowledgement email to the customer, and notify the assigned ticket owner.
Below is the code for sending the acknowledgment emails when a new ticket is created in the customer support pipeline:
Workflow Mails – WorkflowMails.doc – Please find the attachment with the code for sending emails via workflow
Once saved and activated, the workflow will automatically send the acknowledgement email every time a new ticket is created in the support pipeline.
While workflows react instantly to events, schedules allow us to monitor records over time. In simple terms, workflows respond immediately, and schedules keep watch in the background.
Now, let's handle the second part of the topping use case: monitoring tickets that remain unresolved for too long. For that, we need to create a schedule and associate it with a function.
Let's move into the scheduler implementation.
Creating a schedule for idle tickets
A schedule is a time-based execution mechanism that allows a function to run automatically at defined intervals. Unlike workflows, which react to record actions, schedules operate independently and continuously in the background.
For our use case, we need to monitor tickets after they're created and ensure they aren't left unresolved for long periods. This means the system should periodically check existing records, evaluate their status, and take action if certain conditions are met. Since this requirement is based on time rather than a user-triggered event, a schedule is the best solution.
To implement this, navigate to the Schedules section in the Bigin Developer Console and create a new schedule. Once you provide a name, choose Writing Function for the Function to be executed option.
You'll be redirected to the deluge editor to implement the reminder logic.
In this function, you need to implement the reminder logic that evaluates each ticket and determines whether follow-up action is required. The function should retrieve the necessary ticket details, compare the ticket’s created time with the current time, verify that the ticket isn't already resolved, and then trigger a reminder email to the assigned owner if it's been longer than the set time.
The code below implements the logic for scheduled reminder:
Scheduler Mail – SchedulerMail.doc – Please find the attachment with the code for sending emails via schedule
Once you save the script, you’ll be redirected to the scheduler configuration page.
Here, provide a schedule name and choose an upcoming date and time for the Execution Start Date, since schedules must begin in the future. Under Frequency, select Hourly and configure it to run every 12 hours to match the reminder requirement. In the Ends section, choose Never because we want the schedule to continue running without stopping.
After saving, the scheduler will automatically execute the function at the defined intervals.
At this point, everything for the topping is in place. You can now test and publish it.
Once the topping is published, whenever a new ticket is created in the Customer Support Pipeline, an acknowledgment email will be sent to the customer and a notification email will be sent to the ticket owner.
If the ticket remains in an unresolved stage for more than 24 hours, the scheduled function will trigger and send a reminder email to the ticket owner every 12 hours until the ticket is resolved.
In this post, we explored how to use workflows and schedules together to automate real-time actions and time-based monitoring in a Bigin topping. The workflow sends emails when a ticket is created, and the schedule checks tickets periodically to send reminders if they remain unresolved. This approach helps ensure consistent follow-up without manual monitoring.
Stay tuned for more posts where we'll dive deeper into additional features and best practices for developing powerful toppings in Bigin.