Create or Update Record step
Summarize
Summary of Create or Update Record step
The Create or Update Record step in ServiceNow enables you to either create a new record or update an existing record within a specified table using a single operation. It identifies existing records based on fields you designate as unique identifiers, allowing precise control over when records are updated versus created. This step is available as an action in Workflow Studio and requires theactiondesignerrole to create custom actions incorporating it.
Show less
Key Features
- Identification of existing records: Select fields as unique identifiers (e.g., short description and priority for an incident) to find records that match input values. If a match exists, the record is updated; if not, a new record is created. If no unique identifier is specified, a new record is always created.
- Input fields: Provide the target table and field values to set or update. Dynamic values can be added via drag-and-drop from the Data panel or pill picker.
- Limitations: Cannot update multiple journal fields such as additional comments or work notes in task records. Server-side validation rules can be triggered, but UI policies cannot.
- Failure handling: Option to either continue to the next step or stop and go to error evaluation if the action fails. This does not affect the step’s status output.
Outputs
- Record: Reference to the created or updated record.
- Table: Name of the table where the record was created or updated.
- Error Message: Text describing any error that occurred during the operation.
- Status: Indicates whether the action created a record, updated a record, or produced an error.
- Step Status: Contains runtime details such as a status code (0 for success, 1 for error) and a step status message describing errors or success.
Practical Use Example
When creating or updating a problem record, for instance, you provide inputs for description and user reference fields. The step uses these values and checks the Problem statement and Opened by fields to determine uniqueness. If a matching record exists, it updates it; otherwise, it creates a new problem record.
Why it Matters
This step simplifies data management by combining create and update operations into a single, configurable action. It reduces the need for multiple conditional checks in workflows, ensuring data consistency and improving automation efficiency.
Create or update a record in a ServiceNow table using a single operation. Update a record that exists, or create a record using the values provided.
Identification of existing records
The Create or Update Record step identifies existing records by searching for matching values in the fields that you select as unique identifiers. For example, you can specify that the short description and priority fields uniquely identify an incident. When the step finds an incident with a matching short description and priority, it updates the matching record rather than creating a new record.
- If no field is selected as a unique identifier, the step creates a record with the field values provided.
- If more than one record matches the value of the unique identifiers, the step doesn't update any records and displays an error message in the flow execution details.
Roles and availability
Available as an Workflow Studio action step. Users with the action_designer role can create a custom action with one or more action steps.
Inputs
Provide a value for each input that your action needs. To add dynamic values, you can also drag and drop pills from the Data panel or select them from the pill picker.
- Table
- Data type: Table Name
Table in which to create or update a record.
- Fields
- Data type: Template Values
Field values to set or update for the record. For example, to set the short description to a certain value, select Short description and set the desired value.
Important:The system does not support updating multiple journal fields such as the additional comments or work notes of a task record.If adding the action to a subflow, you can Create a template value input. Dynamically set field values can trigger server-side validation rules but cannot trigger UI policies.
- Determines uniqueness
- Data type: True/False
Option for selecting the field as a unique identifier, which determines when to update or create a record. A record is updated when the incoming field value matches an existing record field value. A record is created when the incoming field value does not match an existing record field value. This option appears when the required table name and fields are selected.
- If this step fails
- Data type: Choice
Option to continue running the next step or go to error evaluation. This option has no effect on the Step Status output. Choices include:
- Don't stop the action and go to the next step: Continues running the action at the next step.
- Go to Error Evaluation: Stops running the action and goes to the Error Evaluation section.
Outputs
These outputs appear in the Data panel. You can use them as inputs elsewhere in your action.
- Record
- Data type: Record
Reference to record created or updated.
- Table
- Data type: Table Name
Table where record was created or updated.
- Error Message
- Data type: String
Error message produced when the record operation fails.
- Status
- Data type: Choice
Completion status of the action. The flow execution details page displays one of these values.
- Created [created]: The action created a record.
- Updated [updated]: The action updated a record.
- Error [error]: The action produced an error.
- Step Status
- Data type: Object
Object data pill containing runtime details about the step. Each step in an action returns a Step Status.
- Step Status Code
- Data type: Integer
Integer data pill indicating whether the step produced an error. A step returns a value of 1 when it produces an error for any reason. For example, a step can produce an error if it is missing mandatory input data or returns output in the wrong data type. A step returns a value of 0 when it runs successfully. You cannot customize these codes.
- Success [0]: The step succeeded.
- Error [1]: The step produced an error.
- Step Status Message
- Data type: String
String data pill containing the error message produced by the step or system operation. You cannot customize the step status message.
Create or update a problem record
This action has two inputs. There is a string input for a description, and a reference input for a User record. The Create or Update Record step uses these inputs to create or update a problem record. The Problem statement and Opened by fields determine uniqueness. When the input values match, the step performs an update operation instead of a create operation.