{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":2464,"path":"application-development/servicenow-sdk/record-api-now-ts.md","title":"Record API - ServiceNow Fluent","bundle":null,"doc_type":null,"release":"australia","body":"\n# Record API - ServiceNow Fluent\n\nThe Record API defines records in any table. Use the Record API to define application metadata that doesn't have a dedicated ServiceNow Fluent API.\n\n**Note:** For the latest ServiceNow Fluent API documentation and examples, see the [ServiceNow Fluent API reference](https://servicenow.github.io/sdk/category/api-reference) and [ServiceNow SDK examples repository](https://github.com/ServiceNow/sdk-examples) on GitHub.\n\n**Parent Topic:**[ServiceNow Fluent API reference](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/application-development/servicenow-sdk/servicenow-fluent-api-reference.md)\n\n**Related topics**  \n\n\n[ServiceNow Fluent](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/application-development/servicenow-fluent.md)\n\n## Record object\n\nAdd data to any table with a record.\n\n<table id=\"table_vy2_525_jq\" class=\"parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\n$id\n\n</td><td>\n\nString or Number\n\n</td><td>\n\nRequired. A unique ID for the metadata object. When you build the application, this ID is hashed into a unique sys\\_id. For more information, see [ServiceNow Fluent language constructs](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/application-development/servicenow-sdk/fluent-constructs.md).Format: `Now.ID['String' or Number]`\n\n</td></tr><tr><td>\n\ntable\n\n</td><td>\n\nString\n\n</td><td>\n\nRequired. The name of the table to which the record belongs.\n\n</td></tr><tr><td>\n\ndata\n\n</td><td>\n\nObject\n\n</td><td>\n\nFields and their values in the table. For example:```javascript\ndata: {\n   state: 'Ready',\n   task: 'Add demo data'\n}\n```\n\nTo use text content from another file, refer to a file in the application using the `Now.include` syntax. For more information, see [ServiceNow Fluent language constructs](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/application-development/servicenow-sdk/fluent-constructs.md).\n\n```javascript\ndata: {\n   script: Now.include('./script-file.js'),\n   html: Now.include('./html-file.html'),\n   css: Now.include('./css-file.css')\n }\n```\n\n</td></tr><tr><td>\n\n$meta\n\n</td><td>\n\nObject\n\n</td><td>\n\nMetadata for the application metadata.With the installMethod property, you can map the application metadata to an output directory that loads only in specific circumstances.\n\n```javascript\n$meta: {\n      installMethod: 'String'\n}\n```\n\nValid values for installMethod:\n\n-   demo: Outputs the application metadata to the `metadata/unload.demo` directory to be installed with the application when the **Load demo data** option is selected.\n-   first install: Outputs the application metadata to the `metadata/unload` directory to be installed only the first time an application is installed on an instance.\n\n</td></tr></tbody>\n</table>In this example, a record defining a menu category is added to the Menu Category \\[sys\\_app\\_category\\] table. The menu category style is defined in the `css-file.css` file.\n\n```javascript\nimport { Record } from \"@servicenow/sdk/core\";\n\nexport const appCategory = Record({\n   table: 'sys_app_category',\n   $id: Now.ID[9],\n   data: {\n      name: 'example',\n      style: Now.include\\('./css-file.css'\\),\n   },\n})\n```\n\nIn this example, a record defining an incident is added to the Incident \\[incident\\] table.\n\n```javascript\nimport { Record } from '@servicenow/sdk/core';\n\nexport const incident1 = Record({\n  $id: Now.ID['incident-1'],\n  table: 'incident',\n  data: {\n    active: 'true',\n    approval: 'not requested',\n    description: 'Unable to send or receive emails.',\n    incidentState: '1',\n    shortDescription: 'Email server is down.',\n    subcategory: 'email',\n    callerId: '77ad8176731313005754660c4cf6a7de',\n  }\n})\n```\n\nIn this example, a record defining a server is added to the Server \\[cmdb\\_ci\\_server\\] table.\n\n```javascript\nimport { Record } from '@servicenow/sdk/core';\n\nexport const ciserver1 = Record({\n  $id: Now.ID['cmdb-ci-server-1'],\n  table: 'cmdb_ci_server',\n  data: {\n    assetTag: 'P1000199',\n    attested: 'false',\n    canPrint: 'false',\n    company: 'e7c1f3d53790200044e0bfc8bcbe5deb',\n    cost: '2160',\n    costCc: 'USD',\n    cpuSpeed: '633',\n    cpuType: 'GenuineIntel',\n    diskSpace: '100',\n    manufacturer: 'b7e7d7d8c0a8016900a5d7f291acce5c',\n    name: 'DatabaseServer1',\n    os: 'Linux Red Hat',\n    shortDescription: 'DB Server',\n    subcategory: 'Computer',\n  }\n})\n```\n\n"}}