Update Data
The update_data() method modifies existing records in DealCloud. Writes are parallelized within create_concurrency and chunked by cellPaginationLimit (Advanced configuration); HTTP via intapp-rest-client.
Basic Update
from dealcloud_sdk import DealCloud, DealCloudConfig
config = DealCloudConfig(
siteUrl="yoursite.dealcloud.com",
clientId=12345,
clientSecret="your-secret",
)
dc = DealCloud.from_config_object(config)
# Update records (requires EntryId)
updates = [
{
"EntryId": 12345,
"Revenue": 1500000,
"Status": 101
},
{
"EntryId": 12346,
"Revenue": 800000,
"Status": 102
}
]
result = dc.update_data("Company", updates)⚠️
Every record must include EntryId (or a lookup column value when using use_dealcloud_ids=False).
Finding Entry IDs
From Previous Read
# Read, modify, update
companies = dc.read_data("Company", output="list", query="{Status: 'Pending'}")
updates = []
for company in companies:
updates.append({
"EntryId": company["EntryId"],
"Status": 101 # Approved status ID
})
dc.update_data("Company", updates)Using Lookup Column
# Update by external ID
updates = [
{
"ExternalId": "CRM-001", # Unique field
"Revenue": 2000000
}
]
dc.update_data(
"Company",
updates,
use_dealcloud_ids=False,
lookup_column="ExternalId"
)Partial Updates
You only need to include fields you're changing:
# Only update Revenue - other fields unchanged
updates = [
{"EntryId": 12345, "Revenue": 1500000},
{"EntryId": 12346, "Revenue": 800000},
]
dc.update_data("Company", updates)Clearing Field Values
To clear a field, set it to None:
# Clear the Description field
updates = [
{"EntryId": 12345, "Description": None}
]
dc.update_data("Company", updates)Input Formats
updates = [
{"EntryId": 12345, "Status": 101},
{"EntryId": 12346, "Status": 102},
]
dc.update_data("Company", updates)Reference Field Updates
# Update reference by EntryId (default)
updates = [
{
"EntryId": 12345,
"PrimaryContact": 67890 # Contact EntryId
}
]
dc.update_data("Company", updates)
# Update by lookup value
updates = [
{
"EntryId": 12345,
"PrimaryContact": "john.smith@example.com" # Email lookup
}
]
dc.update_data(
"Company",
updates,
use_dealcloud_ids=False,
lookup_column="Email" # Lookup field on Contact
)Multi-Select Updates
# Replace all values
updates = [
{
"EntryId": 12345,
"Industries": [101, 102, 103] # Replaces existing values
}
]
dc.update_data("Company", updates)Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
object_id | str | int | Required | Object API name or ID |
data | List[dict] | DataFrame | Required | Records to update (accepts pandas or Polars) |
use_dealcloud_ids | bool | True | Use IDs vs lookup values |
lookup_column | str | None | Field for record lookup |
output | str | "list" | Output format: "list", "write_result", "pandas", or "polars" |
error_handling | ErrorHandling | FAIL_FAST | How to handle transport errors in parallel batches |
raise_on_row_errors | bool | False | When True, raise on row-level "Errors" in HTTP 200 body |
progress_callback | Callable | None | Progress callback |
Output Formats
# List (default)
result = dc.update_data("Company", updates)
# Pandas DataFrame
result = dc.update_data("Company", updates, output="pandas")
# Polars DataFrame
result = dc.update_data("Company", updates, output="polars")Error Handling
from dealcloud_sdk import ErrorHandling
# Collect transport errors (returns BatchResult)
result = dc.update_data(
"Company",
updates,
error_handling=ErrorHandling.COLLECT
)
print(f"Updated: {len(result.results)}, row errors: {len(result.row_errors)}")
for record in result.row_errors:
print(record["EntryId"], record["Errors"])Common Update Errors
| Error | Cause | Solution |
|---|---|---|
| Missing EntryId | No identifier provided | Add EntryId or use lookup_column |
| Invalid reference | Reference ID doesn't exist | Verify reference EntryId |
| Record not found | EntryId doesn't exist | Verify EntryId is correct |
Typed Update
Using Pydantic models:
from pydantic import BaseModel
class Company(BaseModel):
EntryId: int
CompanyName: str
Revenue: float
# Read as typed
companies = dc.typed_read_data(
Company,
object_id="Company",
query="{Status: 'Active'}"
)
# Modify
for company in companies:
company.Revenue *= 1.1 # 10% increase
# Update
result = dc.typed_update_data("Company", companies, Company)Bulk Update Pattern
from dealcloud_sdk import DealCloud, DealCloudConfig
config = DealCloudConfig(
siteUrl="yoursite.dealcloud.com",
clientId=12345,
clientSecret="your-secret",
)
dc = DealCloud.from_config_object(config)
# Efficient bulk update
def bulk_update_status(object_id: str, old_status: int, new_status: int):
# Read affected records
records = dc.read_data(
object_id,
output="list",
fields=["EntryId"],
query=f"{{Status: {old_status}}}"
)
if not records:
return 0
# Build updates
updates = [{"EntryId": r["EntryId"], "Status": new_status} for r in records]
# Update in batches (SDK handles this)
dc.update_data(object_id, updates)
return len(updates)
count = bulk_update_status("Company", old_status=201, new_status=202)
print(f"Updated {count} records")Best Practices
- Include only changed fields - Don't send unchanged data
- Verify EntryIds exist - Read before update if unsure
- Use lookup columns for integrations - Easier to maintain external ID mappings
- Batch updates - Group related changes
- Handle errors gracefully - Use COLLECT for batch operations
Related
- Insert Data - Creating records
- Upsert Data - Insert or update
- ID Mapping - External ID mapping