team-ownership
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesePrereq: read first. JSONL piping, pagination, dry-run/digest/confirm, and recovery live there. Reshape patterns live in .
bulk-operations/SKILL.mdhubspot historybulk-operations/resources/json-patterns.mdhubspot_owner_idcontactscompaniesdealsticketshubspot owners listteamshubspot_owner_id前置要求:请先阅读。JSONL管道传输、分页、试运行/摘要/确认以及恢复的相关内容均在该文档中。数据重塑模式可查看。
bulk-operations/SKILL.mdhubspot historybulk-operations/resources/json-patterns.mdhubspot_owner_idcontactscompaniesdealsticketshubspot owners listteamshubspot_owner_id1. Resolve email → owner ID
1. 将邮箱转换为所有者ID
Never hardcode IDs — they are portal-specific. Resolve, then cache:
bash
FROM_ID=$(hubspot owners list | jq -r 'select(.email=="sarah@company.com") | .id')
TO_ID=$(hubspot owners list | jq -r 'select(.email=="mike@company.com") | .id')切勿硬编码ID——ID是特定于门户的。请先解析并缓存:
bash
FROM_ID=$(hubspot owners list | jq -r 'select(.email=="sarah@company.com") | .id')
TO_ID=$(hubspot owners list | jq -r 'select(.email=="mike@company.com") | .id')2. Find records for an owner
2. 查找某所有者的记录
Same filter across all four object types. Add object-specific for context. Unowned records use the form.
--properties!propertybash
hubspot objects search --type contacts --filter "hubspot_owner_id=$FROM_ID" --properties email,firstname,lifecyclestage
hubspot objects search --type companies --filter "hubspot_owner_id=$FROM_ID" --properties name,domain
hubspot objects search --type deals --filter "hubspot_owner_id=$FROM_ID" --properties dealname,dealstage,amount
hubspot objects search --type tickets --filter "hubspot_owner_id=$FROM_ID" --properties subject,hs_pipeline_stage所有四种对象类型使用相同的筛选规则。可添加对象特定的参数以获取上下文信息。无所有者的记录使用格式筛选。
--properties!propertybash
hubspot objects search --type contacts --filter "hubspot_owner_id=$FROM_ID" --properties email,firstname,lifecyclestage
hubspot objects search --type companies --filter "hubspot_owner_id=$FROM_ID" --properties name,domain
hubspot objects search --type deals --filter "hubspot_owner_id=$FROM_ID" --properties dealname,dealstage,amount
hubspot objects search --type tickets --filter "hubspot_owner_id=$FROM_ID" --properties subject,hs_pipeline_stageRecords with no owner at all
无所有者的记录
hubspot objects search --type deals --filter "!hubspot_owner_id" --properties dealname,amount
>100 hits — page with the `--after` loop from `bulk-operations`. Counting only: pipe to `wc -l`.hubspot objects search --type deals --filter "!hubspot_owner_id" --properties dealname,amount
>若结果超过100条,请使用`bulk-operations`中的`--after`循环进行分页。仅统计数量的话,可将结果管道传输至`wc -l`。3. Bulk reassign — search → update
3. 批量重新分配——搜索→更新
Reshape each search row into and pipe to . Always dry-run first; for >100 rows the dry-run emits a digest + — re-run with / (see § "Safe destructive workflow").
{id, properties:{hubspot_owner_id}}objects updateapply_command_hint--digest--confirmbulk-operations/SKILL.mdbash
undefined将每条搜索结果重塑为格式,并管道传输至命令。请始终先执行试运行;若结果超过100条,试运行会生成摘要及——请按照中“安全破坏性工作流”章节的说明,添加/参数重新运行。
{id, properties:{hubspot_owner_id}}objects updateapply_command_hintbulk-operations/SKILL.md--digest--confirmbash
undefinedDry-run
试运行
hubspot objects search --type contacts --filter "hubspot_owner_id=$FROM_ID"
| jq -c --arg to "$TO_ID" '{id, properties:{hubspot_owner_id:$to}}'
| hubspot objects update --type contacts --dry-run
| jq -c --arg to "$TO_ID" '{id, properties:{hubspot_owner_id:$to}}'
| hubspot objects update --type contacts --dry-run
hubspot objects search --type contacts --filter "hubspot_owner_id=$FROM_ID"
| jq -c --arg to "$TO_ID" '{id, properties:{hubspot_owner_id:$to}}'
| hubspot objects update --type contacts --dry-run
| jq -c --arg to "$TO_ID" '{id, properties:{hubspot_owner_id:$to}}'
| hubspot objects update --type contacts --dry-run
Execute — ≤100: drop --dry-run. >100: append --digest <hash> --confirm <count>.
执行——≤100条:移除--dry-run参数。>100条:添加--digest <哈希值> --confirm <数量>参数。
hubspot objects search --type contacts --filter "hubspot_owner_id=$FROM_ID"
| jq -c --arg to "$TO_ID" '{id, properties:{hubspot_owner_id:$to}}'
| hubspot objects update --type contacts
| jq -c --arg to "$TO_ID" '{id, properties:{hubspot_owner_id:$to}}'
| hubspot objects update --type contacts
Single-record assignment — no stdin, no jq:
```bash
hubspot objects update --type contacts 12345 --property hubspot_owner_id=$TO_IDhubspot objects search --type contacts --filter "hubspot_owner_id=$FROM_ID"
| jq -c --arg to "$TO_ID" '{id, properties:{hubspot_owner_id:$to}}'
| hubspot objects update --type contacts
| jq -c --arg to "$TO_ID" '{id, properties:{hubspot_owner_id:$to}}'
| hubspot objects update --type contacts
单条记录分配——无需标准输入,无需jq:
```bash
hubspot objects update --type contacts 12345 --property hubspot_owner_id=$TO_ID4. Rep-leaves workflow
4. 销售代表离职工作流
Loop over the four object types the rep touches:
bash
FROM_ID=$(hubspot owners list | jq -r 'select(.email=="leaving@company.com") | .id')
TO_ID=$(hubspot owners list | jq -r 'select(.email=="taking-over@company.com") | .id')
for type in contacts companies deals tickets; do
echo "── $type ──"
hubspot objects search --type "$type" --filter "hubspot_owner_id=$FROM_ID" \
| jq -c --arg to "$TO_ID" '{id, properties:{hubspot_owner_id:$to}}' \
| hubspot objects update --type "$type" --dry-run
doneReview each digest line, then re-run without (adding / per type when escalated). Mis-reassigned? lists the affected IDs.
--dry-run--digest--confirmhubspot history --since 1h遍历该销售代表负责的四种对象类型:
bash
FROM_ID=$(hubspot owners list | jq -r 'select(.email=="leaving@company.com") | .id')
TO_ID=$(hubspot owners list | jq -r 'select(.email=="taking-over@company.com") | .id')
for type in contacts companies deals tickets; do
echo "── $type ──"
hubspot objects search --type "$type" --filter "hubspot_owner_id=$FROM_ID" \
| jq -c --arg to "$TO_ID" '{id, properties:{hubspot_owner_id:$to}}' \
| hubspot objects update --type "$type" --dry-run
done查看每条摘要信息,然后移除参数重新运行(当结果数量较多时,需按对象类型添加/参数)。分配错误?可使用命令查看受影响的ID。
--dry-run--digest--confirmhubspot history --since 1h5. Team-level views (client-side grouping)
5. 团队级视图(客户端分组)
Group records by , join to for human-readable emails:
hubspot_owner_idowners listbash
hubspot objects search --type deals --filter "dealstage!=closedwon AND dealstage!=closedlost" \
--properties hubspot_owner_id --format json \
| jq '.data | group_by(.properties.hubspot_owner_id)
| map({owner_id: .[0].properties.hubspot_owner_id, count: length})' \
> /tmp/by-owner.json
hubspot owners list \
| jq --slurpfile by /tmp/by-owner.json -r \
'. as $o | $by[0][] | select(.owner_id==$o.id) | "\($o.email)\t\(.count)"'按对记录进行分组,关联结果以获取易读的邮箱地址:
hubspot_owner_idowners listbash
hubspot objects search --type deals --filter "dealstage!=closedwon AND dealstage!=closedlost" \
--properties hubspot_owner_id --format json \
| jq '.data | group_by(.properties.hubspot_owner_id)
| map({owner_id: .[0].properties.hubspot_owner_id, count: length})' \
> /tmp/by-owner.json
hubspot owners list \
| jq --slurpfile by /tmp/by-owner.json -r \
'. as $o | $by[0][] | select(.owner_id==$o.id) | "\($o.email)\t\(.count)"'