Episode 483: Synchronizing Daily with Master Data in kintone

Monday, May 16, 2016
"Customer list" is typical of "database". (Weather managed in paper or in computer.)

Data stored in "Database" is roughly classified into
  • A) Master information (Master type data)
    • Product master
    • Client master
    • Price list, etc.
  • B) Log information (Transaction type data)
    • Payment history
    • Orders record
    • Access log, etc.
And in day-to-day business, there are many occasions that you want to refer to data which is classified in A), master type data.

The following Business Process is a mechanism to synchronize "Client Master data" in the Workflow environment with client master information which is managed in "kintone", a Cloud Database, on a daily basis. (It may be considered as a Batch processing.) It is excellent for not only all the Steps having been automated, but also being capable of manually synchronization at any time.

After all, it becomes possible to refer the latest "Client Master" in a variety of business, such as "Estimate Process", "Order report Process", or "Billing Process". You might be able to eliminate so-called "name identification". (Moreover, it also has the meaning of auto-backup of data in kintone.)

[Client Master Synchronization]

"kintone", a Cloud-database service, provides APIs.

It will be capable of synchronization of various data by Server-to-server communication in the following format.
  • https://${YOUR-DOMAIN}.cybozu.com/k/v1/record.json?app=1&id=1
  • https://${YOUR-DOMAIN}.cybozu.com/k/v1/records.json?app=1
Note) For utilizing kintone APIs, "Custom header feature" (Questetra BPM Suite v11.0: 2016-05-23) is required.

[API communication]
For anyone who is capable of "Excel function", for example, half a day will be enough for learning to "mechanism of API communication" from "How to setup Master information table". (However, there may be somebody who feel that it is tricky on the point that it is sent and received in a text format of JSON.)

* By the way, I guess there are many people who wonder "Where is App ID indicated at?" You just refer to the number in the URL for browsing the list ( https://example.cybozu.com/k/3/). "3" is the number in this example.

= Overview of the Master information table creation (kintone)
  1. Name the information table (Customers)
  2. Write the description of the information table
  3. Define data items
  4. (Drag & Drop a format of the item that is required for Master management)
  5. (Setup [Field code] which is required for auto-processing respectively)
  6. (Confirm the alignment of items)
  7. Setup the view of All items list
  8. Setup the communication for data synchronization (API Token)
  9. (Write down the API token)
  10. Run the Master information table
  11. Register client data into the Master
  12. (Refer to the client data list)

[Capture: 1-12]

= Overview of Auto-request configuration
  1. Place a Throwing Message Intermediate Event icon
  2. Fill in the [Access URL] to kintone API (Method:GET)
  3. Fill in "X-Cybozu-API-Token" and "API Token" into custom header setting
  4. Specify the data item to store Response JSON

= Setting sample of Script Step "List Generate" (Server-side JavaScript)
//// == Retrieving == 
var myJson = data.get("1") + ""; // JSON text 

//// == Calculating == 
var customersData = JSON.parse( myJson ); 
var numOfRecords = customersData.totalCount - 0; 

var value_id_list = ""; 
var display_label_list = ""; 
for (i = 0; i < numOfRecords; i++){ 
  value_id_list += customersData.records[i].customerCode.value + "\n"; 
  display_label_list += customersData.records[i].customerName.value + "\n"; 

//// == Updating == 
retVal.put("4", value_id_list); 
retVal.put("5", display_label_list); 

= JSON sample (Line breaks and indent have been added for easy-to understand)
// Value of All record all field of which viewing is authorized will be returned if query or fields is omitted 

  {"customerName":{"type":"SINGLE_LINE_TEXT","value":"Google Inc."},
   "personInCharge":{"type":"SINGLE_LINE_TEXT","value":"Sergey Brin"},
   "value":"Questetra, Inc."},
   "personInCharge":{"type":"SINGLE_LINE_TEXT","value":"IMAMURA Genichi"},

[Client Master Synchronization:"1. Confirmation" screen]

[Data Items list]

[Free Download]
<Similar Models>
<<Related Articles>>

[Japanese Entry (和文記事)]