Discoverable Procedures

These procedures are created automatically when you discover specific Salesforce objects. Each discovery creates ten different procedures for that object.

Discovery Process

Command: discover [OBJECT_TYPE] from salesforce

It can be both a string or a noun phrase, where the Object Type is the Salesforce Object’s name.

Examples

discover "contact" from salesforce
discover opportunity from salesforce
discover "account" from salesforce

Entity Name Pluralization

The Salesforce book automatically creates proper plural forms for discovered objects using intelligent pluralization rules.

Examples

Object Type
Singular Usage
Plural Usage

contact

create a contact

retrieve contacts

opportunity

create an opportunity

retrieve opportunities

account

create an account

retrieve accounts

case

create a case

retrieve cases

Finding Object Names

  • Salesforce object names are typically lowercase (e.g., "contact", "opportunity")

  • Custom objects usually end with "__c" (e.g., "custom_product__c")

  • Use Salesforce setup to find exact object API names if needed


Discoverable Procedures

After discovery, you can use these ten generated procedures for that object.

1. Create a Single Record

Command: create a [object] in salesforce

Purpose: Create a new record of the discovered object type.

Required Parameters:

  • the body is [DATA] - The data for the new record

Example:

discover "contact" from salesforce

create a json
use the above as the body
set the body's "LastName" to "Test Contact"
set the body's "Email" to "[email protected]"

create a contact in salesforce
  the body is the body

Returns: The newly created record with all fields populated.


2. Create Multiple Records

Command: create some [objects] in salesforce

Purpose: Create multiple records of the same object type in a single operation.

Required Parameters:

  • the bodies are [DATA_LIST] - List of data for multiple records

Example:

get '[{"LastName": "Created2", "Email":"[email protected]"},{"LastName": "Created3", "Email":"[email protected]"}]' as a json
use the above as the contacts

create some contacts in salesforce
  the bodies are the contacts

Returns: List of newly created records.

Important Notes:

  • If any record fails, all successfully created records are automatically rolled back

  • Provides transactional safety for bulk operations


3. Retrieve Records

Command: retrieve [objects] from salesforce

Purpose: Get a list of records from the discovered object type.

Optional Parameters:

  • the limit is [NUMBER] - Maximum number of records to retrieve (default: 10)

  • the offset is [NUMBER] - Number of records to skip for pagination

  • whose [FIELD] is [VALUE] - Filter records by specific criteria

Examples:

# Get all records (up to default limit)
retrieve some opportunities from salesforce

# Get specific number of records
retrieve some opportunities from salesforce
  the limit is 3

# Get records with filtering
retrieve some contacts from salesforce whose Name is "BOF Report"

# Get records with pagination
retrieve some accounts from salesforce
  the limit is 20
  the offset is 40

Returns: A list of records matching the criteria.


4. Delete Single Record

Command: delete a [object] in salesforce

Purpose: Delete a specific record.

Required Parameters:

  • the [object] is [RECORD] - The record to delete

Example:

delete the contact in salesforce

Returns: None (deletes the record).


5. Delete Multiple Records

Command: delete some [objects] in salesforce

Purpose: Delete multiple records in a single operation.

Required Parameters:

  • the [objects] are [RECORD_LIST] - The records to delete

Example:

delete the contacts in salesforce

Returns: None (deletes the records).

Important Notes:

  • Reports any records that failed to delete

  • Continues processing even if some deletions fail


6. Update Record

Command: update a [object] in salesforce

Purpose: Update an existing record with new data.

Required Parameters:

  • the [object] is [RECORD] - The record with updated data

Example:

set the contact's "Title" to "The New Title"
update the contact in salesforce

Returns: None (updates the record).

Important Notes:

  • Automatically filters out non-updatable fields

  • Only sends changed data to Salesforce


7. Upload Attachment

Command: upload an attachment to a [object]

Purpose: Attach a file to a Salesforce record.

Required Parameters:

  • the [object] is [RECORD] - The record to attach the file to

  • the file is [FILE] - The file to upload

  • the file name is [NAME] - Name for the attached file

Example:

upload an attachment to the contact
  the file is the file
  the file name is "test.jpg"

Returns: None (uploads the attachment).


8. Download Attachments

Command: download attachments from a [object]

Purpose: Download all attachments from a Salesforce record.

Required Parameters:

  • the [object] is [RECORD] - The record to download attachments from

Optional Parameters:

  • whose [FIELD] is [VALUE] - Filter attachments by criteria

Example:

download some attachments from the contact

Returns: List of file attachments.


9. Delete Attachments

Command: delete the attachments from a [object]

Purpose: Delete all attachments from a Salesforce record.

Required Parameters:

  • the [object] is [RECORD] - The record to delete attachments from

Optional Parameters:

  • whose [FIELD] is [VALUE] - Filter which attachments to delete

Example:

deletethe the attachments from the contact

Returns: None (deletes the attachments).


10. Submit for Approval

Command: submit a [object] for approval

Purpose: Submit a record to a Salesforce approval process.

Required Parameters:

  • the [object] is [RECORD] - The record to submit (must have Id and OwnerId)

  • the process is [PROCESS_NAME] - Name of the approval process

Optional Parameters:

  • the comment is [COMMENT] - Comment to include with submission

Example:

submit the opportunity for approval
  the process is "Test_Opportunity_1"
  the comment is "I need approval for this opportunity"

Returns: None (submits for approval).

Important Notes:

  • Record must have both Id and OwnerId fields

  • Process name must match exactly with Salesforce approval process

  • Will error if record is already in an approval process


Tips for Success

Object Discovery

  • Use lowercase object names: "contact", "opportunity", "account"

  • For custom objects, include the "__c" suffix: "custom_product__c"

  • Discover objects before using their specific procedures

Working with Data

  • Use create a json to build record structures

  • Use set the [variable]'s "[field]" to "[value]" to populate fields

  • Check Salesforce field requirements (required vs optional fields)

Bulk Operations

  • Use plural procedures for efficiency with multiple records

  • Bulk create operations provide automatic rollback on failure

  • Bulk delete continues processing even if individual records fail

Attachments

  • Attachments are stored using Salesforce's ContentDocument system

  • File name parameter is required for uploads

  • Downloads return all attachments as separate files

Approvals

  • Records need the Id and OwnerId fields for approval submission

  • Process names must match exactly with the Salesforce setup

  • Check the approval process configuration in Salesforce admin

Reports

  • Export options include Excel files and data tables

  • Data table export is useful for further data processing

  • Report filters use standard Salesforce field names


Troubleshooting

Connection Issues

  • Username/Password: Verify credentials and security token are current

  • Permissions: In case of authorization errors, check user has appropriate Salesforce permissions

Discovery Issues

  • Use exact Salesforce API object names (usually lowercase)

  • Check object exists and is accessible to your user

  • Custom objects need "__c" suffix

Record Operations

  • Required Fields: Check Salesforce object setup for required fields

  • Field Names: Use exact API field names (case-sensitive)

  • Permissions: Ensure user can create/update/delete specific objects

Attachment Issues

  • File Size Limits: Salesforce has file size restrictions

  • File Types: Some file types may be blocked by organization settings

  • Storage Limits: Check available file storage in Salesforce

Approval Issues

  • Process Names: Must match approval process exactly as configured

  • Record State: Records already in approval can't be resubmitted

  • Required Fields: Record must have both Id and OwnerId populated

Email Issues

  • Email Addresses: All recipients must be valid email addresses

  • Email Deliverability: Check Salesforce email deliverability settings

  • Permissions: User must have permission to send emails through Salesforce

Last updated

Was this helpful?