Developer Function: Server Script: items.Create
## Overview
Create a record in the table for the specified site ID. This method can be used to specify an object (Syntax 1) or a JSON string (Syntax 2).
## Limitations
1. The ID of the created record cannot be obtained from the return value of items.Create. If you write a script using syntax 1 as shown in Usage Example 1 below, you can obtain the ID of the created record. If you use Syntax 2 as in Usage Example 2 and 3, you cannot get the ID of the created record.
## Syntax 1
```
items.Create(siteId, model)
```
## Parameters
|Parameter|Type|Required|Description|
|:----------|:----------|:---:|:---------------------------|
|siteId|object|Yes|Specify the site ID of the target table.|
|model|object|Yes|Specify the apiModel object obtained by the items.NewSite, items.NewIssue, Items.Result methods.|
## Return Value
If the record is created, true is returned. If not, false is returned.
The contents of the created record, including the record ID, are reflected in the model.
## Syntax 2
```
items.Create(siteId, json)
```
## Parameters
|Parameter|Type|Required|Description|
|:----------|:----------|:---:|:---------------------------|
|siteId|object|Yes|Specify the site ID of the target table|
|json|string|Yes|Specify the JSON string|
## Return Value
If the record is created, it returns true; if not, it returns false.
## Usage Example 1
The following is an example of using Syntax 2. Create an apiModel object with the items.NewIssue method, and create a record with the title "How to Install Pleasanter" in the time-limited table with site ID 123.
##### JavaScript
```
// Script for time limited table
let sampleApiModel = items.NewIssue();
sampleApiModel.Title = 'How to install Pleasanter';
items.Create(123, sampleApiModel);
context.Log(sampleApiModel.IssueId); // Output the ID of the record created to the browser console
```
To create a record in the recorded table, write the following script. The contents written in the first and fifth lines are different from those for the time-limited table.
##### JavaScript
```
// Recorded table script
let sampleApiModel = items.NewResult();
sampleApiModel.Title = 'How to install Pleasanter';
items.Create(123, sampleApiModel);
context.Log(sampleApiModel.ResultId); // Output the ID of the created record to the browser console
```
## Usage Example 2
The following is an example of using Syntax 2. Create a record with the title "About the Filter Function of Pleasanter" in the table with site ID 123.
##### JavaScript
```
items.Create(123, '{"Title": "About the Filter Function of Pleasanter"}');
```
## Usage Example 3
The following is an example of using Syntax 2. Create a Wiki site under the folder with site ID 1.
##### JavaScript
```
let data = {
ApiVersion: 1.1,
Title: "Wiki test",
ReferenceType: "Wikis",
ParentId: 1,
InheritPermission: 1,
SiteSettings: {
ReferenceType: "Wikis"
}
}
items.Create(1, JSON.stringify(data));
```
## Related Information
・[Manage Table: Server script](/manual/table-management-server-script)
・[Execution Timing for Each Object](/manual/server-script-conditions)
・[Items Object](/manual/server-script-items)
・[Items Object: New Method](/manual/server-script-items-new)