|Note: The latest release this documentation applies to is Fuji. For the Helsinki release, see Record Producer. Documentation for later releases is also on docs.servicenow.com.|
A record producer is a specific type of catalog item that allows end users to create task-based records (such as incident records) from the service catalog. Record producers provide a simplified alternative to the regular form interface for creating records.
|Note: Use record producer to create task-based records only.|
You can create a record producer for tables and database views that are in the same scope as the record producer and for tables that allow create access from applications in other scopes, starting with the Fuji release.
|Note: To ensure that standard service catalog processes are followed, such as initiating workflows as expected, do not create requested item records from record producers. Instead, create requested item using catalog items.|
2 Defining Record Producers in the Service Catalog
- Navigate to Service Catalog > Catalog Definition > Record Producers.
- Click New or select the record producer to edit.
- Fill in the fields on the Record Producer form (see table).
- Click Submit.
- Open the record again to define variables for the record producer.
|Note: You may need to configure the form to see all the fields below.|
|Name||The descriptive name for the record producer.|
|Table name|| The table in which the record producer creates records.
Note: The list shows only tables and database views that meet the scope protections for field styles (starting with the Fuji release).
|Active||A check box for making the record producer active. Only active record producers are available to users if they meet the role criteria.|
|Preview Link||A link that opens a preview of the item.|
|Catalogs||The service catalog this record producer belongs to.|
|Category||The service catalog category this record producer belongs to. When users perform catalog searches, only items that are assigned to a category appear in search results.|
|View||The CMS view in which the item is visible.|
|Roles||The roles required to use the record producer.|
|Availability||The interface the record producer is available from: Desktop and Mobile, Desktop Only, or Mobile Only.|
|Can cancel||A check box for displaying a Cancel button on the record producer. Users can click Cancel to cancel the record producer and return to the last-viewed screen.|
|What it will contain|
|Short description||A short summary of the record producer.|
|Description||The full description of the record producer. The description appears under a More information link on the record producer to give users any additional information they may need.|
|Script||Scripts that should be run to dynamically assign values to specific fields on the created record.|
|Icon||The small icon that appears on the list of service catalog items. Click the Click to add link and upload the photo.|
|Picture||The picture that appears at the top of the record producer form on the desktop view. Click the Click to add link and upload the photo.|
|Mobile picture|| The small picture that appears on the list of service catalog items. Click the Click to add link and upload the photo.
This field is available when you select the Mobile for the Mobile picture type.
|Mobile picture type|| The picture that the mobile interface uses on the list of service catalog items. Select one of the following:
|Generated Record Data|
|Template||Static assignments for fields on the created record.|
2.1 Populating Record Data
To populate data with a record producer, use any combination of the following methods:
- Create a variable on the record producer with the same name as the field in the target record. For example, a variable named caller_id on a Create a New Incident record producer populates the caller_id field on the new incident record. Use a variable type that corresponds to the field type.
- Define a template to assign a static field value for all records created by the record producer.
- Define a script that uses any variable or server-side objects and functions to assign values.
- Use current.*FIELD_NAME* to reference fields on the record being created.
- Use producer.*VARIABLE_NAME* to reference values entered by the end user.
2.2 Redirect After Submitting a Record Producer
To redirect an end user to a particular page after the record producer is submitted, define the redirect link in the Script field using producer.redirect. For example, the following code redirects users to their homepage after the record producer is submitted:
3 Creating Record Producers from Tables
To save time, you can create service catalog record producers directly from a table record (starting with the Dublin release).
To create a record producer from a table record:
- Navigate to System Definition > Tables and open the table record.
|Note: When using a workflow with a Record producer, set the condition to Run the workflow.|
- Under Related Links, click Add to Service Catalog.
- Complete the Name, Short Description, and Category fields as you would for service catalog items.
- Use the slushbucket to select the fields and the order in which you want them to appear. To use container variables, select |- container start -| and |- container end -|.
- Click Save and Open to open the record producer and define additional options. Alternatively, click Save to return to the table record.
- A record producer is created with these values:
- Table name: table record opened in step 1
- Name, Short Description, and Category: information entered in step 3
- A variable is created for each of the selected fields with these values:
- Name: Column name of the field
- Type: variable type that corresponds to the field type
- Order: position selected in the slushbucket (for example, 100 for the first field and 200 for the second field)
- Question: Column label of the field
- If the field type is Choice, a corresponding question choice is created for each field choice.
- The new record producer is added to the Record Producers related list on the table record.
- A record producer is created with these values:
4 Creating Variables for Field Types
Use these variable types to collect data for the corresponding field types.
|Field type||Recommended variable type|
|Date or Due Date||Date|
|Choice or any field with an associated choice list||Select Box|
|List or UI Action List||List Collector|
|String with length greater than 256||Multi Line Text|
|String, Integer, Decimal, Floating Point Number||Single Line Text|
|All other field types||Multi Line Text|
4.1 Values Returned
When you construct a record producer, you should be aware of the return value.
Most of these field types return a string. However, there are some exceptions. For example, a Reference value returns the sys_id of the target object, and a List value returns a comma-separated list of sys_ids.
Example 1: For a List value, return an array which can be iterated to retrieve the individual values submitted by your user:
var sys_id_string = producer.glide_list_field; var sys_id_list = string.split(',');
Example 2: For a Date or Date/Time value, return a date which can be evaluated by GlideDate.
var glideDateTime = new GlideDateTime(producer.date_field);