Skip to content

pacx data create

github-actions[bot] edited this page Jul 19, 2026 · 1 revision

Creates a record in a Dataverse table.

Usage

Overview

This command creates a new record in the specified Dataverse table. You can provide field values using a plain key=value syntax, a JSON string, or a JSON file.

Input modes

Exactly one of the following input modes must be used (they are mutually exclusive):

  • --plain (-p): semicolon-separated list of field=value pairs, e.g. firstname=Mario;lastname=Rossi
  • --json (-j): a JSON object string representing the record payload
  • --file (-f): path to a JSON file containing the record payload

Supported field types

Type Format Example
String / Memo Any text value firstname=Mario
Integer Whole number numberofemployees=100
Decimal / Double Decimal number revenue=1234.56
Money Monetary value estimatedvalue=50000
Boolean true/false, 1/0 donotbulkemail=true
Date Only yyyy-MM-dd birthdate=1990-05-20
Date & Time ISO 8601 overriddencreatedon=2024-01-15T08:30:00Z
Choice (OptionSet) Integer code or label text statecode=0 or statecode=Active
Multi-Select Choice Comma-separated codes or labels new_tags=Red,Blue,Green
Lookup entity(GUID) or entity(field='value') ownerid=systemuser(domainname='user@org.com')

Lookup references

Lookup fields accept two formats:

  • entity(GUID): directly references a record by its GUID, e.g. ownerid=systemuser(3fa85f64-5717-4562-b3fc-2c963f66afa6)
  • entity(field='value'): resolves a record by a field value, e.g. ownerid=systemuser(domainname='mario.rossi@contoso.com')

If the field value itself contains a single quote, escape it by doubling it: entity(name='Riccardo''s Corp').

--plain escaping rules

The --plain tokenizer uses the following rules:

  • Fields are separated by semicolons (;)
  • The first = in each token separates the field name from the value; subsequent = characters are part of the value
  • Single quotes (') delimit sections where semicolons are treated as literal characters
  • To include a literal single quote in a value, write two consecutive single quotes ('')
  • An empty value (field=) is valid and sets the field to null

Options

  • --id: optional GUID to assign to the new record; if omitted Dataverse generates one
  • --return (-r): comma-separated list of columns to retrieve after creation and display; if omitted only the record ID is shown
  • --dry-run (-dr): validates and displays the resolved payload without actually creating the record

Examples

# Create a contact with simple values
pacx data create -t contact --plain "firstname=Mario;lastname=Rossi"

# Create an account with a lookup resolved by field
pacx data create -t account --plain "name=Acme Corp;ownerid=systemuser(domainname='mario.rossi@contoso.com')"

# Assign a predetermined GUID to the new record
pacx data create -t account --plain "name=Acme Corp" --id 3fa85f64-5717-4562-b3fc-2c963f66afa6

# Create and return specific fields
pacx data create -t contact --plain "firstname=Mario;lastname=Rossi" --return "firstname,lastname,fullname"

# Use --json (useful for AI pipelines)
pacx data create -t opportunity --json '{"name":"Big Deal","estimatedvalue":50000}'

# Create from a JSON file
pacx data create -t contact --file ./new-contact.json

# Dry-run: validate the payload without creating
pacx data create -t contact --plain "firstname=Mario;birthdate=1990-05-20" --dry-run

# Multi-select choice by label
pacx data create -t new_survey --plain "new_tags=Red,Blue,Green"

# Polymorphic lookup (Customer)
pacx data create -t incident --plain "title=Support Case;customerid=account(accountnumber='ACME001')"

# Clear a nullable field
pacx data create -t contact --plain "description="

# Value with single quote (escape with '')
pacx data create -t account --plain "name=Riccardo''s Corp"

Arguments

Long Name Short Name Required? Description Default value Valid values
table t Y Logical name of the target table. - String
dry-run dr N Validates the payload without creating the record. False true, false
file f N Path to a JSON file containing the record payload. Mutually exclusive with --plain and --json. - String
id N Optional GUID to assign to the new record. - Guid
json j N JSON string representing the record payload. Mutually exclusive with --plain and --file. - String
plain p N Semicolon-separated list of field=value pairs. Mutually exclusive with --json and --file. - String
return r N Comma-separated list of columns to return after creation. If omitted, only the record ID is returned. - String

Command list

Clone this wiki locally