Get Record

Contents

Get Record ID - kintone.app.record.getId()

Retrieves the Record ID of the currently open record.

Function

Desktop

kintone.app.record.getId()

Mobile

kintone.mobile.app.record.getId()

Parameters

none

Response

  • Number or null
  • Null is returned for pages where it cannot be used.

Sample

1
2
var recordId = kintone.app.record.getId();
console.log(recordId);

Available Pages (Desktop)

  • Record Details
  • Record Edit
  • Record Print

Available Pages (Mobile)

  • Record Details
  • Record Edit

Get Record Details - kintone.app.record.get()

Retrieves record data of the currently open record in JSON format.

Function

Desktop

kintone.app.record.get()

Mobile

kintone.mobile.app.record.get()

Parameters

None

Response

  • An object with record details, or null.
  • Null is returned for pages where it cannot be used.
  • If the API is used on the Record Create or Record Edit page, the returned data will include the current edited data.
  • Attachment file data is already converted to an empty array on the Record Create and Record Edit pages.

Sample

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
var record = kintone.app.record.get();
console.log(record);

// Sample Response
// {
//     "record": {
//         "updated_time": {
//             "type": "UPDATED_TIME",
//             "value": "2018-03-15T09:22:00Z"
//         },
//         "creator": {
//             "type": "CREATOR",
//             "value": {
//                 "code": "john-d",
//                 "name": "John Doe"
//             }
//         },
//         "radiobutton_0": {
//             "type": "RADIO_BUTTON",
//             "value": "January"
//         },
//         "created_time": {
//             "type": "CREATED_TIME",
//             "value": "2018-02-15T09:22:00Z"
//         },
//         "record_id": {
//             "type": "RECORD_NUMBER",
//             "value": "1"
//         },
//         "updater": {
//             "type": "MODIFIER",
//             "value": {
//                 "code": "john-d",
//                 "name": "John Doe"
//             }
//         },
//         "checkbox": {
//             "type": "CHECK_BOX",
//             "value": [
//                 "Sunday",
//                 "Monday"
//             ]
//         }
//     }
// }

Available Pages (Desktop)

  • Record Details
  • Record Create
  • Record Edit
  • Record Print

Available Pages (Mobile)

  • Record Details
  • Record Create
  • Record Edit

Notes

  • kintone.app.record.get and kintone.mobile.app.record.get cannot be called in the kintone.events.on handler. If you need to retrieve record data in the event handler, utilize the event object, as that has the record data inside.

Get Record Field Element - kintone.app.record.getFieldElement()

Retrieves the field element of a field in the record, by specifying the field code.

Function

Desktop

kintone.app.record.getFieldElement(fieldCode)

Mobile

kintone.mobile.app.record.getFieldElement(fieldCode)

Parameters

PARAMETER VALUE REQUIRED DESCRIPTION
fieldCode String Yes Specify the field code of the field you want to retrieve.

Response

  • A string of field elements, or null.
  • Null is returned for pages where it cannot be used.

Sample

1
2
// Retrieve the field element of field with the field code of "title"
kintone.app.record.getFieldElement('title');

Available Pages

  • Record Details
    (Cannot be called on the Record edit/create page, or the notification page)
  • Record Print

Notes

  • The retrieval of data and the DOM’s style is supported
  • Changing the internal structure of the DOM may lead to features not functioning correctly after a Kintone update.
  • The following fields cannot be retrieved with kintone.app.record.getFieldElement(fieldCode), and null will be returned
    • Status
    • Assignee
    • Fields within tables
    • Fields within Related records
  • The following fields cannot be retrieved with kintone.mobile.app.record.getFieldElement(fieldCode), and null will be returned
    • Status
    • Assignee
    • Tables
    • Fields within tables
    • Related records
    • Fields within Related records
    • Field groups
  • Null will be returned if you specify a field you have no access to.

Set Record Value - kintone.app.record.set()

Places values inside fields of the record that is currently being edited.

Function

Desktop

kintone.app.record.set(record)

Mobile

kintone.mobile.app.record.set(record)

Parameters

PARAMETER VALUE REQUIRED DESCRIPTION
record JSON Yes Specify the record data as JSON. (The format is the same as the response for kintone.app.record.get)

Response

None

Sample

1
2
3
var record = kintone.app.record.get();
record.record.single_text_field.value = 'new content!';
kintone.app.record.set(record);

Available Pages (Desktop)

  • Record Create
  • Record Edit

Available Pages (Mobile)

  • Record Create
  • Record Edit

Notes

  • kintone.app.record.set and kintone.mobile.app.record.set cannot be called in the kintone.events.on handler.If you need to retrieve record data in the event handler, utilize the event object, as that has the record data inside.
  • The following operations can be performed:
    • Replacing a field value
    • Make a field editable or disabled
    • Set a field error
    • Automatically run a lookup field
    • Automatically clear a lookup field

Get Record Header Menu Element - kintone.app.record.getHeaderMenuSpaceElement()

Retrieves the empty space element of the header of the record, i.e. the space highlighted in the below image.

Record Header Menu Screenshot

Function

kintone.app.record.getHeaderMenuSpaceElement()

Parameters

None

Response

  • The space element of the header.
  • Null is returned for pages where it cannot be used.

Sample

1
var el = kintone.app.record.getHeaderMenuSpaceElement();

Available Pages

  • Record Details
  • Record Create
  • Record Edit

Notes

  • The visual aspect of this element may change unexpectedly, as the stylesheet of Kintone takes effect on it.
  • We do not recommend the following changes, as Kintone may function unexpectedly when clicked:
    • adding INPUT elements with TYPE attributes of “submit”
    • adding BUTTON elements to empty elements

Get Space Element - kintone.app.record.getSpaceElement()

Retrieves the element of a Blank space field that you have placed inside your record form.

Space Screenshot

Function

Desktop

kintone.app.record.getSpaceElement(spaceId)

Mobile

kintone.mobile.app.record.getSpaceElement(spaceId)

Parameters

PARAMETER VALUE REQUIRED DESCRIPTION
spaceId String Yes The element ID of the Blank space field. When you place a Blank space field inside your app form, you can assign an element ID through the field’s option.

Response

  • The element of the specified Space field.
  • Null is returned if the specified Space field does not exist.
  • Null is returned for pages where it cannot be used.

Sample

1
var el = kintone.app.record.getSpaceElement('space1');

Available Pages (Desktop)

  • Record Details
  • Record Create
  • Record Edit
  • Record Print

Available Pages (Mobile)

  • Record Details
  • Record Create
  • Record Edit

Retrieves the App ID of the Datasource app of the specified Related records field, in the record.

Desktop

kintone.app.getRelatedRecordsTargetAppId(fieldCode)

Mobile

kintone.mobile.app.getRelatedRecordsTargetAppId(fieldCode)

PARAMETER VALUE REQUIRED DESCRIPTION
fieldCode String Yes Specify the field code of the Related records field.
  • The App ID or null.
  • Null is returned for the following cases:
    • The specified field does not exist.
    • The specified field cannot be viewed.
    • The specified field is not a Related records field.
1
var related = kintone.app.getRelatedRecordsTargetAppId('reference');
  • Record List
  • Record Create
  • Record Edit
  • Record Details
  • Record Print
  • Graph
  • File Import
  • File Export
  • Plug-in config page
  • Record List
  • Record Create
  • Record Edit
  • Record Details
  • Graph
  • As long as you have permission to view the specified field, you can retrieve the datasource App ID even if you don’t have access to view the data in the datasource app.

Get Lookup Target - kintone.app.getLookupTargetAppId()

Retrieves the App ID of the Datasource app of the specified Lookup field, in the record.

Function

Desktop

kintone.app.getLookupTargetAppId(fieldCode)

Mobile

kintone.mobile.app.getLookupTargetAppId(fieldCode)

Parameters

PARAMETER VALUE REQUIRED DESCRIPTION
fieldCode String Yes Specify the field code of the Lookup field.

Response

  • The App ID or null.
  • Null is returned for the following cases:
    • The specified field does not exist.
    • The specified field cannot be viewed.
    • The specified field is not a Lookup field.

Sample

1
var related = kintone.app.getLookupTargetAppId('reference');

Available Pages (Desktop)

  • Record List
  • Record Create
  • Record Edit
  • Record Details
  • Record Print
  • Graph
  • File Import
  • File Export
  • Plug-in config page

Available Pages (Mobile)

  • Record List
  • Record Create
  • Record Edit
  • Record Details
  • Graph

Notes

  • As long as you have permission to view the specified field, you can retrieve the datasource App ID even if you don’t have access to view the data in the datasource app.

Get Mobile Header Element - kintone.mobile.app.getHeaderSpaceElement()

Retrieves the empty space element below the header of the record for smartphones, i.e. the space highlighted in the below images.

Record List View

The retrieved element is between the View name and the Record List.

Record List View Screenshot

Record List View (Calendar)

The retrieved element is below the black header.

Calendar View Screenshot

Record Details Page

The retrieved element is between the Record Title and the Details/Comments/History tabs.

Record Details Page Screenshot

Record Edit Page

The retrieved element is between the Record Title and the Details/Comments/History tabs.

Record Edit Page Screenshot

Record Create Page

The retrieved element is between “New record” and the Details tab.

Record Create Page Screenshot

Function

kintone.mobile.app.getHeaderSpaceElement()

Parameters

None

Response

  • The element of the empty space element below the header of the record is returned.
  • Null is returned for pages where it cannot be used.

Sample

1
var el = kintone.mobile.app.getHeaderSpaceElement();

Available Pages

  • Record List
  • Record Details
  • Record Edit
  • Record Create