Schedule cron jobs with Azure Functions


This article continues on from the previous Kintone x Azure Functions article: Get record data with Azure Functions 

In this article, we will go through how to set up codes that run at scheduled timings (every hour, every day etc) using Azure Functions.


The following is the overview of a the integration in this article.

We will use two Kintone Apps in this example: an Expense Report App and an Expense Summary App.
Users use the Expense Report App to record their expenses, such as travel expenses. The Expense Report App has a workflow set up, where users will need to get approval from their manager when the expense is submitted.

A scheduled program runs at 2:00AM on the first day of the month, that sums up all of the expenses for each department from last month, and adds a record to the Expense Summary App for each department.


Overview of the integration



List of records containing expenses in the Expense Report App



Details of a record containing expense details and total expenses




List of records in the Expense Summary App with expense totals for each department


Prepare Azure Functions

Follow the Create your first function in the Azure portal article on the Microsoft Azure website to set up Azure Functions.
Choose the "Timer" and "JavaScript" options, as shown in the below image.


In this article, we will use the following packages:

  • request (package to execute HttpRequests)
  • request-promise (package to use Promises)
  • moment (package to operate on dates)

Refer to Get record data with Azure Functions on how to install the packages.

Kintone App Template

In this example we will use the template provided below, containing the Expense Report App and the Expense Summary App:
AzureFunctions integration (scheduled event).zip

Refer to the App Templates page in the Kintone Help for how to import App templates, and to the Creating an App from a Template page on how to create Apps from templates.

JavaScript Code Flow

The code in this integration will process as follows:

  1. Get data of all approved records in the Expense Report App from last month.
  2. Sum up travel expenses by department.
  3. Add a record to the Expense Summary App for each department, containing data of the summed up expenses.

Write the Source Code

Refer to Get record data with Azure Functions for information on where to write the code.

Copy and paste the JavaScript code above into the code editor and modify the Kintone subdomain, App ID and API token to fit your Kintone environment. Information on generating API tokens can be found in the Using API Token authentication article.

Set up the Scheduler



Set up the scheduler using Cron expressions in the "Schedule" field.

Use the below table as reference for scheduled timings.


Cron expression

{second} {minute} {hour} {day} {month} {day of the week}

Trigger every 5 minutes

0 */5 * * * *

Trigger every hour

0 0 * * * *

Trigger every two hours

0 0 */2 * * *

Trigger every hour from 9 AM to 5 PM

0 0 9-17 * * *

Trigger every day at 9:30 AM

0 30 9 * * *

Trigger every weekday at 9:30 AM

0 30 9 * * 1-5



Azure Functions is a great way to run codes automatically at a given schedule. We hope you can use this article as reference to use Azure Functions to solve issues you may have for periodically adding or getting to and from Kintone Apps.


Was this article helpful?
0 out of 0 found this helpful
Do you have any questions or issues related to this article?
Please share your views with us in the Community forums!