Skip to content

forcedotcom/sf-skills / skills/consumer-goods-promotion-bo-api-deploy

consumer-goods-promotion-bo-api-deploy

Verified

Use to enable the Consumer Goods Cloud TPM Promotion Business Object (BO) API framework in a Salesforce org, interview the user for the custom Workflow Step they want to add, generate and deploy that Apex class, wire it into the create/update/copy workflows, and prove it end-to-end via headless REST ingest. Ships a worked reference example (SetCommentValue) but the customization is user-supplied per org. Triggers on "deploy the promotion BO API", "set up promotion BO API", "headless promotion create", "add a BO API workflow step".

assets/set-comment-value/SetCommentValue.cls

View on GitHub
/**
 * Custom BO API Workflow Step: lifts a top-level `Comment` value out of
 * the ingest tactic input onto Tactic.Comment__c.
 *
 * Registered against the `Tactic` BO API entity and wired into the
 * `create`, `update`, and `copy` workflows by the
 * deploy-promotion-bo-api skill.
 *
 * Namespace-agnostic: derives the Tactic namespace from the passed
 * SObject at runtime and never types `<ns>__Tactic__c` at compile time,
 * so the same class works under `cgcloud`, `cgcloud_dev`, and
 * source-deployed (no prefix) orgs.
 *
 * Context keys `currentInput` / `currentOutput` are seeded by the
 * packaged BoTransformationEngine (verified at
 * force-app/main/default/classes/BoTransformationEngine.cls:825-864).
 */
global with sharing class SetCommentValue implements Callable {

  public class SetCommentValueException extends Exception {}

  // MUST be global: on a managed-INSTALLED org the packaged CallableManager
  // resolves/invokes this subscriber Callable across the namespace boundary via
  // Type.forName. A `public` class is invisible there and fails at runtime with
  // `Type "<class>" does not exist` (the ATL row lands in Error). `global` works
  // on both managed-install and same-namespace source/dev orgs.
  global Object call(String action, Map<String, Object> context) {
    if (action != 'setCommentValue') {
      throw new SetCommentValueException('Unsupported action: ' + action);
    }
    if (context == null) {
      throw new SetCommentValueException('null context');
    }

    Object rawInput = context.get('currentInput');
    Object rawOutput = context.get('currentOutput');

    if (!(rawInput instanceof Map<String, Object>)) {
      return null;
    }
    Map<String, Object> tacticInput = (Map<String, Object>) rawInput;

    Object commentValue = tacticInput.get('Comment');
    if (commentValue == null) {
      return null;
    }

    // The engine wraps Tactic__c in TPM_Promotion.TacticRecord (see
    // BoTransformationEngineEntityTree.generateObject:696 —
    //   promo.addTactic(new Tactic__c()) returns a TacticRecord wrapper).
    // Unwrap to the underlying SObject via getRecord() before writing;
    // a raw SObject cast fails silently and the write never persists.
    SObject tactic;
    if (rawOutput instanceof SObject) {
      tactic = (SObject) rawOutput;
    } else if (rawOutput instanceof TPM_Promotion.Record) {
      tactic = ((TPM_Promotion.Record) rawOutput).getRecord();
    } else {
      return null;
    }

    String tacticType = String.valueOf(tactic.getSObjectType());
    String prefix = '';
    if (tacticType.contains('__') && tacticType.endsWith('__c')) {
      Integer firstUnderscoreUnderscore = tacticType.indexOf('__');
      Integer lastUnderscoreUnderscore = tacticType.lastIndexOf('__');
      if (firstUnderscoreUnderscore < lastUnderscoreUnderscore) {
        prefix = tacticType.substring(0, firstUnderscoreUnderscore) + '__';
      }
    }

    tactic.put(prefix + 'Comment__c', String.valueOf(commentValue));
    return null;
  }
}
writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deploymentStars: 322kUpdated Claude CodeCodexVerifiedInstall
xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release.Stars: 118kUpdated Claude CodeCodexVerifiedInstall