# Instructions for Fluent CatalogItemRecordProducer API
Always reference the CatalogItemRecordProducer API specification for more details.
1. `table` is mandatory and must be a valid ServiceNow table name (e.g., `'incident'`, `'change_request'`, `'problem'`). This is the table where a new record will be created on submission.
2. Use `script` for pre-insert logic — map catalog variable values to record fields using `producer.var_name` syntax (e.g., `current.short_description = producer.issue_title`). Do NOT call `current.update()` or `current.insert()` in the `script` property — the record is not yet saved at that point.
3. Use `postInsertScript` for post-insert logic where `current.update()` is safe to call. This runs after the record has been inserted.
4. Variable values are accessed in scripts via `producer.<variable_internal_name>`. The variable internal name is the key used in the `variables` object.
5. Do NOT set `requestMethod` on a record producer: the type has no such property (TS2769, no overload matches). The record producer config takes only the base catalog item properties, catalogs/categories/availability, portal attachment/visibility settings, and its own record-producer fields — `CatalogItem`'s `requestMethod`, `customCart`, `useScLayout`, pricing, delivery, legacy cart, and access-type properties are not accepted.
6. Set `redirectUrl: 'generatedRecord'` (default) to take the user to the newly created record after submission. Use `'catalogHomePage'` to redirect to the catalog home instead.
7. Record producers do NOT use `flow`, `executionPlan`, or `workflow` for fulfillment — the record creation IS the fulfillment. These fields are not applicable to record producers.
8. The shared `CatalogItem` properties (categories, availableFor, variableSets, etc.) apply equally — see the catalog-item instruct for those guidelines.
9. Export the record producer as a named constant so it can be referenced by `CatalogClientScript` and `CatalogUiPolicy` that apply specifically to record producers.
10. **SDK v4.13.0** — `CatalogItemRecordProducer` accepts `$meta`: `installMethod` (`'demo'`, `'once'` or 'first install') controls when the producer loads (not `'demo'`: demo data is only for rows of tables that do not extend `sys_metadata`, per demo-data-guide, SDK v4.14.2), and `useEsLatest` runs its server-side `script` on the latest ECMAScript version. `CatalogItem` itself still has no `$meta`.
