getDeletionImpact
Preview what deleting an org-owned record affects before you do it.
Preview what deleting an org-owned record affects before you do it: it serves every delete op that takes a dependencyResolution, not just the deal ones. Pass targetKind + targetId; returns impactVersion (hand it back to the matching delete op), requiresReplacement, the dependent records grouped, and (when replacement is required) the replacementRequirements (what needs a new home and the valid options). Supported targetKinds: DEAL (deleteDeal), DEAL_PIPELINE / DEAL_STAGE (deletePipeline / deletePipelineStage), CONTACT_CUSTOM_FIELD (deleteContactCustomField), CONTACT_CUSTOM_FIELD_OPTION / DEAL_CUSTOM_FIELD_OPTION (a dropdown option dropped by updateContactCustomField / updateDealCustomField's optionDependencyResolutions), CONTACT_TAG (deleteContactTags), CONTACT_LIST (deleteContactLists), and CONTENT_TEMPLATE (deleteContentTemplate). WORKFLOW_GROUP (a workflow's or appointment reminder's group id) says what references it: deleteAppointmentReminder takes the result as its dependencyResolution, while deleteWorkflow takes no impactVersion, so for a workflow it is read-only. Always call this first: those delete ops need the impactVersion, and it goes stale if anything changes in between: re-read it rather than reusing an old one.
curl https://server.goliathdata.com/api/v1/call \
-H "Authorization: Bearer $GOLIATH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"operationId": "getDeletionImpact",
"variables": {
"targetKind": "PIPELINE_ITEM",
"targetId": "<targetId>"
}
}'import { GoliathClient } from '@goliath-data/sdk'
const goliath = new GoliathClient({
apiKey: process.env.GOLIATH_API_KEY!,
baseUrl: 'https://server.goliathdata.com',
})
// Enum values as strings: the SDK's enum types aren't exported yet, so assert to the method's variables type.
const variables = {
targetKind: 'PIPELINE_ITEM',
targetId: '<targetId>'
} as Parameters<typeof goliath.deals.getDeletionImpact>[0]
const result = await goliath.deals.getDeletionImpact(variables)const res = await fetch('https://server.goliathdata.com/api/v1/call', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.GOLIATH_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
operationId: 'getDeletionImpact',
variables: {
targetKind: 'PIPELINE_ITEM',
targetId: '<targetId>'
}
}),
})
const { data, errors } = await res.json()Variables
The example sends only what the schema requires. Some operations also need one of several optional variables (one filter or another, say); the description above says which.
Response
What comes back under data: a list shows as one entry, and a value as its type.
{
"data": {
"dependencyQuery": {
"getDeletionImpact": {
"impactVersion": "…",
"requiresReplacement": true,
"warnings": [
"…"
],
"groups": [
{
"groupKind": "FILTER",
"title": "…",
"count": 0
}
],
"replacementRequirements": [
{
"targetKind": "PIPELINE_ITEM",
"targetId": "<ID>",
"title": "…",
"options": [
{
"id": "<ID>",
"label": "…",
"subtitle": "…"
}
]
}
]
}
}
}
}Errors
unknown_variableA variable the operation does not declare. A typo is refused rather than silently dropped.
unauthorizedNo bearer header, or the key is invalid or revoked.
insufficient_scopeThe key lacks the scope the operation requires.
forbiddenA referenced record does not exist, was deleted, or is outside your organization. The gateway cannot tell those apart.
Behaviour
A read. It rejects an Idempotency-Key header with 400 bad_request.