consumer-goods-rtr-datacloud-export-configure

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Setup RTR Data Cloud Export

设置RTR Data Cloud导出

Configures the Data-Cloud-targeted RTR exports: the
Data_Cloud_Enabled
system setting, a scoped SF Data Sync, an
RTR_Report_Configuration__c
record (with its
KPI_Set__c
) for Data Cloud export, and the export trigger/status/abort REST calls. Standalone and self-contained — runs on its own, or as a delegated step invoked by
consumer-goods-tpe-dashboard-configure
, which passes through its own already-collected username, dry-run flag, and GenieAdmin confirmation result.
Distinct from a sibling CSV-export RTR skill (if present in this org's checkout): that skill targets
Usage__c IN ('integrationmeta','reportmeta')
for CSV export to the CGCloud Processing Services host. This skill targets Data Cloud export. Same underlying
RTR_Report_Configuration__c
object and
KPI_Set__c
Apex patterns, different
Usage__c
values and
JSON__c
shape — this skill does not invoke or depend on that sibling.
For now, this skill only supports
Usage__c = 'datacloudpromotionmeasuresmeta'
(
JSON__c.object = "promotionmeasures"
) — it is hardcoded, never asked as an input.
datacloudaccountplanmeasuresmeta
(account-plan measures) is not yet wired up.
配置面向Data Cloud的RTR导出:
Data_Cloud_Enabled
系统设置、范围化SF Data Sync、用于Data Cloud导出的
RTR_Report_Configuration__c
记录(及其
KPI_Set__c
),以及导出触发/状态/中止REST调用。本技能独立且自包含——可单独运行,也可作为由
consumer-goods-tpe-dashboard-configure
调用的委托步骤,该调用会传递其已收集的用户名、试运行标志和GenieAdmin确认结果。
与同级CSV导出RTR技能不同(如果本组织的检查项中存在该技能):该技能针对
Usage__c IN ('integrationmeta','reportmeta')
,用于将CSV导出到CGCloud Processing Services主机。而本技能针对Data Cloud导出。两者基于相同的
RTR_Report_Configuration__c
对象和
KPI_Set__c
Apex模式,但
Usage__c
值和
JSON__c
结构不同——本技能不会调用或依赖该同级技能。
目前,本技能仅支持
Usage__c = 'datacloudpromotionmeasuresmeta'
JSON__c.object = "promotionmeasures"
)——此为硬编码设置,不会作为输入询问用户。
datacloudaccountplanmeasuresmeta
(客户计划指标)尚未接入。

Inputs and namespace detection

输入与命名空间检测

Read
references/inputs-and-namespace.md
before starting. It covers:
  • The username/dry-run/GenieAdmin/TPM-Admin/namespace inputs that must be collected (or passed through by a calling skill) before Phase 1.
  • The Sales Org / KPI Set / measure-codes / date-from inputs that Phase 6 collects lazily, per Sales Org, only once its existing-config check comes back empty.
  • The namespace-detection procedure (
    scripts/detect-namespace.js
    ) and the four
    NS
    /
    NS_SEGMENT
    /
    NS_APEX
    /
    NS_FIELD
    derivations used throughout every phase below.
  • scripts/render-apex.js
    (Apex template rendering) and
    scripts/resolve-id-by-name.js
    (name-to-id lookups) both load
    scripts/soql-escape.js
    to escape substituted/queried literals for safe SOQL/Apex interpolation.
开始前请阅读
references/inputs-and-namespace.md
,其中涵盖:
  • 第1阶段前必须收集(或由调用技能传递)的用户名/试运行/GenieAdmin/TPM-Admin/命名空间输入项。
  • 第6阶段针对每个销售组织延迟收集的销售组织/KPI集/指标代码/起始日期输入项,仅当现有配置检查结果为空时才会收集。
  • 命名空间检测流程(
    scripts/detect-namespace.js
    ),以及以下所有阶段中使用的四个派生值
    NS
    /
    NS_SEGMENT
    /
    NS_APEX
    /
    NS_FIELD
  • scripts/render-apex.js
    (Apex模板渲染)和
    scripts/resolve-id-by-name.js
    (名称转ID查询)均加载
    scripts/soql-escape.js
    ,对替换/查询的字面量进行转义,以确保SOQL/Apex插值的安全性。

Phases

阶段

Full step-by-step commands, queries, and Apex templates for every phase are in
references/procedure.md
. Run phases in order.
PhaseSummary
1Verify/assign
GenieAdmin
permission set; confirm
TPM Admin
persona assignment.
2Upsert the
Data_Cloud_Enabled
system setting via anonymous Apex; confirm the write.
3Trigger a scoped SF Data Sync against
System_Setting__c
, after capturing a baseline
Batch_Run_Status__c
Id.
4Poll/verify that sync completed (
Done
/
Error
/
Fatal
/
Running
).
5Verify the
datacloudpromotionmeasuresmeta
picklist value exists on
Usage__c
— if missing, stop and send the user to Setup (no programmatic fix exists).
6Loop, one Sales Org at a time: resolve Sales Org Name → Id, reuse an existing
RTR_Report_Configuration__c
or collect KPI Set/measure-codes/date-from and create one, sync if changed, then ask whether to add another Sales Org.
7Once Phase 6's loop is fully done, trigger the export once per configured Sales Org via
scripts/sf-rest.js
(never
sf api request rest
); capture
requestId
as the export guid.
8Poll each Sales Org's export status (
Ready
/
Error
/
Aborted
/
Queued
/
InProgress
) via
scripts/sf-rest.js
.
9Once every Sales Org has finished polling, ask the user to sync the
promotionmeasures
Data Cloud Data Stream themselves and get explicit confirmation it finished — this skill never triggers that sync.
10Abort an in-flight export via
scripts/sf-rest.js
— only if the user explicitly asks.
11Report pass/blocked/pending per phase.
每个阶段的完整分步命令、查询和Apex模板均位于
references/procedure.md
中。请按顺序运行各阶段。
阶段摘要
1验证/分配
GenieAdmin
权限集;确认
TPM Admin
角色分配。
2通过匿名Apex插入或更新
Data_Cloud_Enabled
系统设置;确认写入操作完成。
3在捕获基准
Batch_Run_Status__c
ID后,触发针对
System_Setting__c
的范围化SF Data Sync。
4轮询/验证同步是否完成(状态为
Done
/
Error
/
Fatal
/
Running
)。
5验证
Usage__c
上是否存在
datacloudpromotionmeasuresmeta
选择列表值——若缺失,停止操作并引导用户前往Setup(无程序化修复方案)。
6循环处理每个销售组织:将销售组织名称解析为ID,重用现有
RTR_Report_Configuration__c
或收集KPI集/指标代码/起始日期并创建新记录,若有变更则同步,然后询问是否添加其他销售组织。
7第6阶段循环完成后,通过
scripts/sf-rest.js
为每个已配置的销售组织触发一次导出(绝不使用
sf api request rest
);捕获
requestId
作为导出GUID。
8通过
scripts/sf-rest.js
轮询每个销售组织的导出状态(
Ready
/
Error
/
Aborted
/
Queued
/
InProgress
)。
9所有销售组织的轮询完成后,要求用户手动同步
promotionmeasures
Data Cloud数据流,并明确确认同步完成——本技能不会触发该同步操作。
10通过
scripts/sf-rest.js
中止正在进行的导出——仅当用户明确要求时执行。
11按阶段报告通过/阻塞/待处理状态。

Rules

规则

  • Never assign a permission set, write a record, or trigger a sync/export without an explicit user go-ahead first.
  • Never guess or hardcode
    Batch_Name__c
    — identify the sync's
    Batch_Run_Status__c
    row by recency against the captured baseline Id, and log the full row set.
  • Never attempt to programmatically add a missing
    Usage__c
    picklist value — the user must add it manually via Setup (link in Phase 5,
    references/procedure.md
    ).
  • Never ask for a Usage type — this skill is hardcoded to
    Usage__c = 'datacloudpromotionmeasuresmeta'
    /
    JSON__c.object = "promotionmeasures"
    for now.
  • When the requested export type is anything other than promotion measures (e.g.
    datacloudaccountplanmeasuresmeta
    /account-plan measures): state the limitation, then stop or ask if the user wants the promotion-measures export instead for that Sales Org. Do not provide field-by-field manual configuration instructions for the unsupported path — no suggested
    Usage__c
    /
    JSON__c
    values, no picklist-add walkthrough. Offering a workaround recipe for the exact path this skill refuses is scope creep, not help. Report the run as blocked, not partially-passed.
  • Never skip Phase 6's existence check (keyed on
    Usage__c
    +
    Sales_Organization__c
    ) — and never overwrite an existing
    RTR_Report_Configuration__c
    found by that check without a separate, explicit user go-ahead.
  • Never trigger Phase 7's export before Phase 6's per-Sales-Org loop is fully done — always ask whether to add another Sales Org before moving from Phase 6 to Phase 7.
  • Always give the user a chance to supply a custom
    Internal_Name__c
    (Phase 6 step 4) — default to
    "Data 360 Promotion Measures Export <Sales Org Name>"
    (no hyphen) only if they decline. This value is also
    metaname
    in Phase 7's export — never invent a different one for that call.
  • Phase 7 exports once per Sales Org, never once for the whole run.
  • Both the Sales Org and the KPI Set are given as Names by the user, resolved to Ids by query — this skill never creates a
    Sales_Organization__c
    , a
    KPI_Set__c
    , or KPI Set junction rows.
  • Never sync a Sales Org's config in Phase 6 unless this run actually created it — reusing an existing config as-is is a no-op, no sync call.
  • Never call the abort endpoint unless the user explicitly asks to abort.
  • Never claim Phase 9 is done on Phase 8's
    Ready
    status alone — always get the user's explicit confirmation that the
    promotionmeasures
    Data Stream was synced, once for the whole batch, before moving to Phase 10.
  • Never hardcode the namespace in a REST path, Apex snippet, or SOQL query — always use the caller-passed or self-detected
    NS
    /
    NS_SEGMENT
    /
    NS_APEX
    /
    NS_FIELD
    .
  • This skill only calls
    global
    Apex classes, REST endpoints, or the anonymous-Apex templates in its own
    scripts/
    directory — never a
    public
    /
    private
    method directly, and never a script or template from outside this skill's own directory.
  • 未经用户明确许可,绝不分配权限集、写入记录或触发同步/导出操作。
  • 绝不猜测或硬编码
    Batch_Name__c
    ——根据捕获的基准ID,按最新性识别同步的
    Batch_Run_Status__c
    行,并记录完整行集。
  • 绝不尝试通过程序化方式添加缺失的
    Usage__c
    选择列表值——用户必须通过Setup手动添加(第5阶段和
    references/procedure.md
    中的链接)。
  • 绝不询问使用类型——目前本技能硬编码为
    Usage__c = 'datacloudpromotionmeasuresmeta'
    /
    JSON__c.object = "promotionmeasures"
  • 当请求的导出类型为促销指标以外的类型(例如
    datacloudaccountplanmeasuresmeta
    /客户计划指标):说明限制,然后停止操作或询问用户是否要为该销售组织改为使用促销指标导出。不得为不支持的路径提供逐字段手动配置说明——不得建议
    Usage__c
    /
    JSON__c
    值,不得提供选择列表添加步骤。为技能拒绝的路径提供变通方案属于超出范围,并非帮助。将运行状态报告为阻塞,而非部分通过。
  • 绝不跳过第6阶段的存在性检查(基于
    Usage__c
    +
    Sales_Organization__c
    )——且未经用户单独明确许可,绝不覆盖通过该检查找到的现有
    RTR_Report_Configuration__c
  • 第6阶段的销售组织循环完全完成前,绝不触发第7阶段的导出——从第6阶段进入第7阶段前,始终询问是否添加其他销售组织。
  • 始终给用户提供自定义
    Internal_Name__c
    的机会(第6阶段第4步)——仅当用户拒绝时,默认使用
    "Data 360 Promotion Measures Export <Sales Org Name>"
    (无连字符)。该值同时也是第7阶段导出中的
    metaname
    ——绝不为该调用创建其他值。
  • 第7阶段为每个销售组织导出一次,绝不针对整个运行过程导出一次。
  • 销售组织和KPI集均由用户提供名称,通过查询解析为ID——本技能绝不创建
    Sales_Organization__c
    KPI_Set__c
    或KPI集关联行。
  • 仅当本次运行实际创建了销售组织的配置时,才在第6阶段同步该配置——按原样重用现有配置为无操作,无需调用同步。
  • 仅当用户明确要求中止时,才调用中止端点。
  • 绝不仅根据第8阶段的
    Ready
    状态就宣称第9阶段已完成——在进入第10阶段前,始终获取用户明确确认
    promotionmeasures
    数据流已同步(针对整个批次确认一次)。
  • 绝不硬编码REST路径、Apex片段或SOQL查询中的命名空间——始终使用调用方传递或自行检测的
    NS
    /
    NS_SEGMENT
    /
    NS_APEX
    /
    NS_FIELD
  • 本技能仅调用
    global
    Apex类、REST端点或自身
    scripts/
    目录中的匿名Apex模板——绝不直接调用
    public
    /
    private
    方法,也绝不使用本技能目录以外的脚本或模板。

Report

报告

At the end of a run, give the user a structured status per phase (1-10): pass / blocked / pending, with the specific blocking reason and remediation click-path where applicable (e.g. the Setup path for a missing picklist value). Call out anything skipped due to dry-run or a declined confirmation.
When invoked via delegation (the calling skill used the
Skill
tool to reach this file, rather than the user directly): this report is an intermediate result, not the end of the task. Return it to the calling skill and let it continue with its own next phase — do not present this report to the user as the final answer and stop. Only surface this report directly to the user when this skill was invoked standalone.
运行结束时,向用户提供按阶段(1-10)划分的结构化状态:通过/阻塞/待处理,以及具体的阻塞原因和相应的修复路径(例如,缺失选择列表值的Setup路径)。标注因试运行或用户拒绝确认而跳过的任何操作。
当通过委托调用时(调用技能使用
Skill
工具访问本文件,而非用户直接调用):本报告为中间结果,并非任务终点。需将其返回给调用技能,由该技能继续执行自身的下一阶段——不得将本报告作为最终答案呈现给用户并停止操作。仅当本技能被独立调用时,才直接向用户展示本报告。