File: sobject.nu 10 exported commands 0 internal commands

sf get

Get a Salesforce record by its ID.

Usage

sf get {flags} <object> <record_id>

Flags

-h, --help
Display the help message for this command
--fields <string>
Optional comma-separated list of fields to return

Parameters

object <string>
SObject type (e.g. Account, Lead, Contact)
record_id <string>
The Salesforce record ID

Input/output types

#inputoutput
0anyany

Examples

get an account by ID

sf get Account 001XXXXXXXXXXXX

get a contact with specific fields

sf get Contact 003XXXXXXXXXXXX --fields "Id,Name,Email"

sf get-by-custom-id

Get a Salesforce record by a custom (external) ID field.

Usage

sf get-by-custom-id <object> <custom_id_field> <custom_id>

Flags

-h, --help
Display the help message for this command

Parameters

object <string>
SObject type
custom_id_field <string>
The external ID field name
custom_id <string>
The external ID value

Input/output types

#inputoutput
0anyany

Examples

get an account by external ID

sf get-by-custom-id Account My_External_Id__c "EXT-001"

sf create

Create a new Salesforce record.

Accepts data as a record (from argument or piped input). Returns the creation result with the new record's Id.

Usage

sf create <object> (data)

Flags

-h, --help
Display the help message for this command

Parameters

object <string>
SObject type (e.g. Account, Lead)
data <record>
Record data to create. Can also be piped in. (optional)

Input/output types

#inputoutput
0anyany

Examples

create an account

sf create Account {Name: "Acme Corp" Industry: "Technology"}

create an account piping the values into the command

{Name: "Acme Corp"} | sf create Account

sf update

Update an existing Salesforce record.

Usage

sf update <object> <record_id> (data)

Flags

-h, --help
Display the help message for this command

Parameters

object <string>
SObject type
record_id <string>
The record ID to update
data <record>
Fields to update. Can also be piped in. (optional)

Input/output types

#inputoutput
0anyany

Examples

update an account

sf update Account 001XXXXXXXXXXXX {Name: "Updated Corp"}

update an account by piping data

{Name: "Updated Corp"} | sf update Account 001XXXXXXXXXXXX

sf upsert

Upsert a Salesforce record using an external ID field.

If a record with the given external ID exists, it's updated. If not, a new record is created.

Usage

sf upsert <object> <ext_id_field> <ext_id_value> (data)

Flags

-h, --help
Display the help message for this command

Parameters

object <string>
SObject type
ext_id_field <string>
External ID field name
ext_id_value <string>
External ID value
data <record>
Record data. Can also be piped in. (optional)

Input/output types

#inputoutput
0anyany

Examples

upsert an account by external ID

sf upsert Account My_External_Id__c EXT-001 {Name: "Acme"}

sf delete

Delete a Salesforce record.

Usage

sf delete <object> <record_id>

Flags

-h, --help
Display the help message for this command

Parameters

object <string>
SObject type
record_id <string>
The record ID to delete

Input/output types

#inputoutput
0anyany

Examples

delete an account

sf delete Account 001XXXXXXXXXXXX

sf describe

Describe an SObject — returns its metadata (fields, relationships, etc).

Usage

sf describe <object>

Flags

-h, --help
Display the help message for this command

Parameters

object <string>
SObject type

Input/output types

#inputoutput
0anyany

Examples

describe an account

sf describe Account

get field details for an account

sf describe Account | get fields | select name type label

sf metadata

Get the metadata for an SObject (lighter than describe).

Usage

sf metadata <object>

Flags

-h, --help
Display the help message for this command

Parameters

object <string>
SObject type

Input/output types

#inputoutput
0anyany

Examples

get account metadata

sf metadata Account

sf deleted

List records that were deleted within a date range.

Usage

sf deleted {flags} <object>

Flags

-h, --help
Display the help message for this command
--start <string>
Start datetime (ISO 8601)
--end <string>
End datetime (ISO 8601)

Parameters

object <string>
SObject type

Input/output types

#inputoutput
0anyany

Examples

list deleted accounts in January 2024

sf deleted Account --start "2024-01-01T00:00:00+00:00" --end "2024-01-31T00:00:00+00:00"

sf updated

List records that were updated within a date range.

Usage

sf updated {flags} <object>

Flags

-h, --help
Display the help message for this command
--start <string>
Start datetime (ISO 8601)
--end <string>
End datetime (ISO 8601)

Parameters

object <string>
SObject type

Input/output types

#inputoutput
0anyany

Examples

list updated accounts in January 2024

sf updated Account --start "2024-01-01T00:00:00+00:00" --end "2024-01-31T00:00:00+00:00"