Learn how to create a mobile app in Unifinity that works with kintone.
In this article, we will show you how to register records in kintone using kintone's REST API.
In my previous article.User Authenticationwill be required, so please check accordingly.
You can download a sample project of the Unifinity kintone application used in the explanation below. We hope you will take advantage of it.
kintone: Record Registration Application
Unifinity: kintone record registration application
Overview of the application to be created
Create a mobile app in kintone that registers records.
Setting up kintone
In this case, we will prepare an application to enter the following items: date, time, string, numerical value, radio button, check box, and drop-down, and register them from the mobile application.
Other commonly used attachments, lookups, tables, and user selections will be presented in another article.
In order to link, the kintone subdomain name, application ID, and field code for each field are required.
The subdomain name and app ID can be found in the following part of the URL when connecting to the app.
The field code for each field can be checked from the application's settings screen.
Unifinity collaboration settings
This section explains screen creation and process creation for each field in KINTONE.
(In this case, input data is not saved in the DB, but it can be saved.)
For basic Unifinity operation, click here.Tutorial Videosfor more information.
0. Preparation
In my previous article.User Authenticationin the application.
Also, set the global variable for the property to the subdomain name identified in the kintone configuration.
[Date]
1. screen creation
(1) Place a text box for entering the date and time.
Also, for text boxes, set the input to "Date/Time" in the object's behavior settings tab.
(2) Set up a button to send the entered information to kintone.
Screen creation is now complete (there are some areas to be updated after creating the process in section 2.)
2. process creation
Create the action when the button created on the screen is pressed.
For each item, we will explain the process one by one.
(1) Subdomain name calling
#2 | ."Variable/Global variable acquisitionto read the kintone subdomain set in the global variable. |
(2) Calling user authentication information
#4 | ."Database/RetrievalUse the "User Authentication Information (X-Cybozu-Authorization:●●●)" to read the "User Authentication Information (X-Cybozu-Authorization:●●●)" stored in the DB. (0. described in Preparation)User Authenticationin your application and specify the DB there.) |
(3) Format data into a format for sending to kintone
When registering data in kintone, the format specified by kintone (e.g.This time, here it is.to format the data.
It will need to be formatted into the following format, and we will show you how to do this below.
#6 | ."Control/Content AcquisitionSelect what is entered on the screen using the |
#7 | ."String Functions/FormatsConvert the contents of #6 to the format "YYYYY-MM-DDThh:mm:ss+09:00" to register the date and time in Kintone using "#6. This is the "field value. The list of formats for registering in kintone isthis way (direction close to the speaker or towards the speaker)for more information. |
#8 | ."Dictionary/CreationThe "I" will be shaped using the "I". "value": To create the format "(field value)", enter value for the key and select the contents of #7 for the value. |
#9 |
Next, create the format "(field code)": {#8}. |
#10 |
Finally, create the format {"app": "(ID of app)", "record": {#9}}. |
#11 |
Finally, the well-formed elements are processed into JSON format. |
(4) Send data to kintone
When registering data in kintone, the URI (URI) specified by kintone (see below) must be used.This time, here it is.to send the data to the (M).
#13 | ."String Functions/Concatenationand generate the RESTAPI URI (https://(subdomain name).cybozu.com/k/v1/record.json) as determined by KINTONE. This time, the contents of #2, which invokes the subdomain name, are concatenated with "/k/v1/record.json". |
#14 |
."Network/HTTP requestto send data to kintone. |
3. stringing
Then, we ask you to link the screen to the process, and you are done.
This is the basic creation process for registering records in KINTONE.
The process for updating other fields is as follows
(Attachments, lookups, tables, and user selection will be presented in a separate article. )
[String (one line), numeric]
String (one line) and numeric registrations are listed together because they are almost identical.
1. screen creation
(1) Place text boxes for text and numerical input.
Also, for strings, please check "All" for input content in the object's behavior settings tab, and for numbers, please check "Numeric" & "Pop-up Input" for input content in the object's behavior settings tab.
(2) Set up a button to send the entered information to kintone.
Screen creation is now complete (there are areas to be updated after process creation in section 2).
2. process creation
Create the action when the button created on the screen is pressed.
For each item, we will explain the process one by one.
(1) Subdomain name calling
The same as the ➜ date and time.
(2) Calling user authentication information
The same as the ➜ date and time.
(3) Format data into a format for sending to kintone
#6 | ."Control/Content AcquisitionSelect what is entered on the screen using the The same is true for numerical values. |
#7 | ."Dictionary/CreationThe "I" will be shaped using the "I". To create the format "value": "(field value)", enter value for the key and select the contents of #6 for the value. |
#8 |
Next, create the format "(field code)": {#7}. |
#9 |
Finally, create the format {"app": "(ID of app)", "record": {#8}}. |
#10 |
Finally, the well-formed elements are processed into JSON format. |
(4) Send data to kintone
The same as the ➜ date and time.
3. stringing
Then, we ask you to link the screen to the process, and you are done.
[Radio button]
1. screen creation
(1) Place the same number of radio buttons as set in kintone.
For the radio buttons, set the radio group in the object's behavior settings tab to the name common to the two buttons (kintone in this case) and also set the ON value to the name of the item to be entered in kintone (sample1 and sample2 in this case).
(2) Set up a button to send the entered information to kintone.
The screen creation is now complete (there are some areas to be updated after creating the DB in section 2 and the process in section 3).
2. creation of DB
(1) Create a DB in Unifinity to store the values selected by the radio buttons.
After creating the data file, enter an easy-to-understand name for the item name and physical item name, and check the Initialize at startup checkbox.
DB creation is now complete.
3. process creation
Create the action when the button created on the screen is pressed.
For each item, we will explain the process one by one.
(1) Subdomain name calling
The same as the ➜ date and time.
(2) Calling user authentication information
The same as the ➜ date and time.
(3) Format data into a format for sending to kintone
#6 | ."Database/Retrievalto select what is entered as a radio button. *This part differs from other cases |
#7 | ."Dictionary/CreationThe "I" will be shaped using the "I". "value": To create the format "(field value)", enter value for the key and select the contents of #6 for the value. |
#8 |
Next, create the format "(field code)": {#7}. |
#9 |
Finally, create the format {"app": "(ID of app)", "record": {#8}}. |
#10 |
Finally, the well-formed elements are processed into JSON format. |
(4) Send data to kintone
The same as the ➜ date and time.
4. stringing
Two things need to be implemented: linking screens to the DB and linking screens to processing.
(1) Linking screens to DB
Link the screen and DB to store the selections made with the radio buttons in the DB created in 2.
First, on the screen where the radio buttons are placed, select nothing (or click on the black area outside the screen) and select the DB created in 2. from the data table name.
After making your selection, select each radio button, check the form for the data content, and select the appropriate field in the DB created in 2. for the field name.
(2) Linking screens and processes
The same as the ➜ date and time.
That is all.
[Check box]
We will introduce the checkboxes as those to be used when multiple selections are desired.
1. screen creation
(1) Place the same number of checkboxes as those set up in kintone.
For checkboxes, set the ON value in the object's behavior settings tab to the name of the item to be entered in kintone (in this case, sample1 and sample2).
(2) Set up a button to send the entered information to kintone.
Screen creation is now complete (there are areas to be updated after process creation in section 2).
2. process creation
Create the action when the button created on the screen is pressed.
For each item, we will explain the process one by one.
(1) Subdomain name calling
The same as the ➜ date and time.
(2) Calling user authentication information
The same as the ➜ date and time.
(3) Format data into a format for sending to kintone
#6,#7 | ."Control/Content Acquisitionto obtain the ON value of a check box. This will require as many checkboxes as there are checkboxes. |
#8,#9 | Since multiple selections will be allowed, cases #8 through #17 will be divided into cases and combinations of ON values will be set. Since whether or not the ON value is entered is the determining factor for the case classification, the "String Functions/Get StringCount the number of characters using |
#10 |
."Control statement/If(start)If checkbox 1 is OFF (the number of characters in the ON value of checkbox 1 is 0), using "#11", move to process #11. If checkbox 1 is ON, then #11 will not be executed and we move on to #12. |
#11 |
."Variables/Variable SettingsSet any variable name to "#1" and set the value of #7: Check box 2. |
#12 |
."Control Statements/ElseIfIf checkbox 2 is OFF (the number of characters in the ON value of checkbox 2 is 0), using #13. If checkbox 2 is ON, then #13 is not executed and the program moves to #14. |
#13 |
."Variables/Variable SettingsSet the same variable name as in #11 in #11 and set the value in #6: Checkbox 1. |
#14 |
."Control statement/ElseIf #10 and #12 are not applicable (both checkboxes 1 and 2 are ON), using "#15", the process will move to #15. |
#15 |
Since both checkboxes 1 and 2 are ON, the values of #6 and #7 should be "xxx,xxx" with "xxx,xxx" in between.String Functions/ConcatenationThe two are connected by a "+". |
#16 |
."Variables/Variable SettingsSet the same variable names as in #11 and #13 in #11: Set the values of checkboxes 1 and 2 in #15: Set the values of checkboxes 1 and 2 in #15. |
#17 |
."Control statement/If(end)Terminate the process started in #10 at "#10". |
#18 |
The processing of #10-17 has set the ON value of the checkbox as a variable, so the "Variable/Variable GetVariables are called by the |
#19 |
In sending data to kintone, it must be in array format. |
#20 |
."Dictionary/CreationUse "#19" to enter the empty variable #19 for the key and select the contents of #18 for the value. This allows multiple selections to be arrayed. |
#21 |
."Dictionary/CreationThe "I" will be shaped using the "I". |
#22 |
Next, create the format "(field code)": {#21}. |
#23 |
Finally, create the format {"app": "(ID of app)", "record": {#22}}. |
#24 |
Processes well-formed elements into JSON format. |
#25 |
For the content converted to JSON in #24, there are parts of the array that are not converted to JSON.String Functions/Replaceand replace "XXX" with "". |
(4) Send data to kintone
The same as the ➜ date and time.
3. stringing
The same as the ➜ date and time.
Then, we ask you to link the screen to the process, and you are done.
[Drop-down]
1. screen creation
(1) Place a combo box with a drop-down selection.
Also, to set the combo box choices, enter the choices you set in the drop-down in kintone in the value entry section in the list tab of the data.
(2) Set up a button to send the entered information to kintone.
Screen creation is now complete (there are areas to be updated after process creation in section 2).
2. process creation
Create the action when the button created on the screen is pressed.
For each item, we will explain the process one by one.
(1) Subdomain name calling
The same as the ➜ date and time.
(2) Calling user authentication information
The same as the ➜ date and time.
(3) Format data into a format for sending to kintone
#6 | ."Control/Content AcquisitionSelect what is entered on the screen using the |
#7 | ."Dictionary/CreationThe "I" will be shaped using the "I". To create the format "value": "(field value)", enter value for the key and select the contents of #6 for the value. |
#8 |
Next, create the format "(field code)": {#7}. |
#9 |
Finally, create the format {"app": "(ID of app)", "record": {#8}}. |
#10 |
Finally, the well-formed elements are processed into JSON format. |
(4) Send data to kintone
The same as the ➜ date and time.
3. stringing
Then, we ask you to link the screen to the process, and you are done.
When sending multiple items
If you wish to send multiple items, you can register them by setting multiple field codes as shown below when you create the dictionary that will be the content of the record.
Please check the details here from the sample application.
In the next issue, we will show you how to create an application that uploads images and other files to a KINTONE record.
The kintone application and sample projects used in this explanation can be downloaded from the following links.
kintone: Record Registration Application
Unifinity: kintone record registration application