dataraptor-transform-optimization

Use when DataRaptor Transform operations are slow, hit governor limits, or use Apex where formula fields would suffice. Covers formula vs Apex expressions, bulk transform sizing, and chained transform composition. Triggers: 'dataraptor transform slow', 'dataraptor formula vs apex', 'dataraptor bulk transform', 'dr governor limit'. NOT for DataRaptor Extract or Load performance.

Best use case

dataraptor-transform-optimization is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Use when DataRaptor Transform operations are slow, hit governor limits, or use Apex where formula fields would suffice. Covers formula vs Apex expressions, bulk transform sizing, and chained transform composition. Triggers: 'dataraptor transform slow', 'dataraptor formula vs apex', 'dataraptor bulk transform', 'dr governor limit'. NOT for DataRaptor Extract or Load performance.

Teams using dataraptor-transform-optimization should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/dataraptor-transform-optimization/SKILL.md --create-dirs "https://raw.githubusercontent.com/PranavNagrecha/AwesomeSalesforceSkills/main/skills/omnistudio/dataraptor-transform-optimization/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/dataraptor-transform-optimization/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How dataraptor-transform-optimization Compares

Feature / Agentdataraptor-transform-optimizationStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Use when DataRaptor Transform operations are slow, hit governor limits, or use Apex where formula fields would suffice. Covers formula vs Apex expressions, bulk transform sizing, and chained transform composition. Triggers: 'dataraptor transform slow', 'dataraptor formula vs apex', 'dataraptor bulk transform', 'dr governor limit'. NOT for DataRaptor Extract or Load performance.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# DataRaptor Transform Optimization

DataRaptor Transforms look simple in the designer but can silently dominate an Integration Procedure's runtime. A Transform can evaluate hundreds of formula fields per row, invoke Apex for each, and run through custom JavaScript functions — and it does this in the synchronous IP context, counting against the same governor limits as the calling Apex.

The two decisions that determine Transform performance are per-field: **formula vs Apex expression** and **row-by-row vs bulk**. Formulas run in the Transform engine with no per-row overhead; Apex expressions cross a boundary and count toward CPU time. Bulk transforms process the whole input array once; row-by-row transforms re-enter the evaluator per row.

Optimizing a Transform is less about rewriting logic and more about picking the right evaluator per field and collapsing avoidable chains.

---

## Before Starting

- Capture the Transform's average input size (rows × fields) in production.
- Capture wall-clock time for a representative execution from debug logs.
- List every field mapping and whether it uses formula, Apex, or JavaScript.

## Core Concepts

### Evaluator Costs

| Evaluator | Per-row cost | Governor hit |
|---|---|---|
| Formula (native) | Low | None |
| Apex expression | Medium | CPU time + possible SOQL |
| JavaScript | Medium | CPU time |
| Remote call (HTTP action in a chained transform) | High | Callout, CPU, apex heap |

Rule of thumb: default to formula; use Apex only when the logic truly needs it (dynamic sObject access, complex regex, crypto).

### Bulk vs Row-By-Row

A bulk Transform receives the full input array and iterates it internally. A row-by-row Transform is invoked per row — each invocation re-parses mappings, re-resolves references, and re-enters the evaluator. The designer does not always make this choice obvious; inspect the XML or JSON export to confirm.

### Chained Transforms

When multiple Transforms run in sequence (e.g. normalize → enrich → shape), each materializes its intermediate output. Collapsing two adjacent Transforms into one saves memory and evaluation cost if the logic composes cleanly.

### CPU Time In Synchronous IPs

An IP that runs in a synchronous context inherits the caller's 10,000 ms CPU limit. Transforms silently accumulate milliseconds; profiling matters.

---

## Common Patterns

### Pattern 1: Formula-First Default

Start every new field mapping in formula mode. Promote to Apex only when you hit something formula cannot do (dynamic field access, callouts, complex string manipulation).

### Pattern 2: Bulk Transform For List Inputs

If the input is an array, confirm the Transform is set to bulk. Row-by-row over 200 rows can be 5-10× slower with no functional difference.

### Pattern 3: Collapse Adjacent Transforms

If two consecutive Transforms share the same input scope, merge them. The combined transform is usually more readable, not less.

### Pattern 4: Projection Before Transform

If the source payload is large but only a few fields are used, add a projection step (DataRaptor Extract with explicit field list) before the Transform to reduce the payload size.

### Pattern 5: Hoist Apex Logic Into Invocable Method

When the same Apex expression fires per row, consider replacing the Transform with a single Invocable Apex that receives the full array and returns transformed output in one call.

---

## Decision Guidance

| Situation | Recommended Approach | Reason |
|---|---|---|
| Simple arithmetic or string concat | Formula | Fastest, no governor cost |
| Dynamic field access or complex regex | Apex expression | Formula cannot express it |
| Same Apex fires N times per row | Bulk Invocable Apex | Collapses N calls to 1 |
| Chained transforms with no consumer between them | Merge | Saves materialization cost |
| Large input, few fields used | Pre-project then transform | Reduces payload size |
| JavaScript function for non-trivial logic | Reconsider — Apex or formula usually better | JS is harder to test and slower |

## Review Checklist

- [ ] Every field mapping uses the cheapest sufficient evaluator.
- [ ] Array-input Transforms are set to bulk.
- [ ] Chains of adjacent Transforms have been reviewed for merging.
- [ ] Input payload is projected before the Transform if large.
- [ ] Per-row Apex has been considered for replacement with bulk Invocable.

## Recommended Workflow

1. Profile — capture current wall-clock and CPU time from IP debug output.
2. Classify — tag each field mapping as formula, Apex, or JavaScript.
3. Promote to formula — rewrite trivial Apex/JS expressions as formulas.
4. Switch to bulk — verify the Transform operates on arrays natively.
5. Merge chains — collapse adjacent transforms that share scope.
6. Re-profile — compare before/after numbers; document gains.

---

## Salesforce-Specific Gotchas

1. JavaScript evaluator blocks cannot share state across rows — any "memoize" pattern re-runs.
2. Apex expressions within a Transform still count against the parent IP's SOQL and DML limits.
3. Bulk mode is opt-in; the designer default varies across OmniStudio versions.
4. Chained Transforms materialize intermediate JSON — large arrays balloon heap use.
5. Formula errors produce silent empty values, not exceptions; add validation downstream.

## Proactive Triggers

- Transform runs row-by-row over an array input → Flag High.
- Apex expression fires per row with the same logic → Flag High.
- Three or more chained Transforms with no consumer between → Flag Medium.
- Transform CPU time > 1000 ms in debug log → Flag High.
- Formula producing empty value on malformed input → Flag Medium.

## Output Artifacts

| Artifact | Description |
|---|---|
| Field-evaluator audit | Per-field current vs recommended evaluator |
| Bulk-mode audit | Per-Transform bulk/row status |
| Chain-merge plan | Which adjacent Transforms can merge |

## Related Skills

- `omnistudio/dataraptor-patterns` — general DR design.
- `omnistudio/omnistudio-performance` — IP/OS performance overall.
- `omnistudio/integration-procedures` — IP step design.
- `apex/bulk-patterns-and-governor-limits` — Apex bulkification.

Related Skills

dataraptor-patterns

8
from PranavNagrecha/AwesomeSalesforceSkills

Use when designing or reviewing OmniStudio DataRaptors, especially Extract versus Turbo Extract versus Transform versus Load, field mapping strategy, performance tradeoffs, and when to move work into Integration Procedures or Apex. Triggers: 'DataRaptor Extract', 'Turbo Extract', 'DataRaptor Load', 'DataRaptor Transform', 'OmniStudio data mapping'. NOT for overall OmniScript journey design or Integration Procedure sequencing when the main question is not the DataRaptor shape itself.

flow-performance-optimization

8
from PranavNagrecha/AwesomeSalesforceSkills

Tune Flow runtime performance: pick Before-Save over After-Save, consolidate Get Records, eliminate loop-DML, cache lookups, split with Scheduled Paths, and measure actual runtime. Covers benchmarking methodology, profiling tools, and the 80/20 wins. NOT for governor-limit math (use flow-governor-limits-deep-dive). NOT for LDV strategy (use flow-large-data-volume-patterns).

flow-get-records-optimization

8
from PranavNagrecha/AwesomeSalesforceSkills

Optimize Get Records elements in Flow: filter sharpness, field selection, sort-and-limit placement, caching via formula resources, and avoiding repeated queries in loops. Trigger keywords: get records, flow soql, flow query limit, flow performance, record lookup. Does NOT cover Apex SOQL, Data Cloud queries, or external object lookups.

soql-query-optimization

8
from PranavNagrecha/AwesomeSalesforceSkills

Use when a SOQL query is running slowly, causing timeouts, or returning UNABLE_TO_LOCK_ROW errors in large data volume orgs. Covers index-aware query writing, selectivity rules, the Query Plan tool, skinny tables, and dynamic field-set queries. Triggers: slow soql query, query timeout, non-selective query, query plan tool, index usage, soql optimization, large object performance. NOT for Apex CPU or heap governor limit issues (use apex-cpu-and-heap-optimization) or for writing basic SOQL (use soql-fundamentals).

cpq-performance-optimization

8
from PranavNagrecha/AwesomeSalesforceSkills

Use when diagnosing or resolving slow CPQ quote calculation, QLEx timeouts, or governor limit errors on large quotes. Trigger keywords: Large Quote Mode, QCP field declaration, quote calculation performance, SBQQ calculation timeout, async pricing. NOT for generic Apex performance tuning, CPQ pricing rule logic design, or billing engine performance.

analytics-dataset-optimization

8
from PranavNagrecha/AwesomeSalesforceSkills

Use this skill when tuning CRM Analytics dataset performance through field selection, date granularity choices, dataset splitting strategy, and run-budget optimization. Trigger keywords: dataset too many fields, SAQL timeseries slow, epoch vs date storage, dataset field count limit, dataset partition, split dataset by year, CRM Analytics performance tuning. NOT for SOQL optimization, Salesforce report tuning, Data Cloud segmentation performance, or choosing between analytics tools.

license-optimization-strategy

8
from PranavNagrecha/AwesomeSalesforceSkills

Auditing, right-sizing, and reclaiming Salesforce licenses to reduce cost and ensure compliant allocation. Trigger keywords: license audit, license cost reduction, unused licenses, permission set license, login-based license, inactive users, license reclamation, right-size licenses. NOT for provisioning net-new licenses (contact AE). NOT for Experience Cloud community license troubleshooting. NOT for permission set assignment logic outside of license gating.

fsl-optimization-architecture

8
from PranavNagrecha/AwesomeSalesforceSkills

Use this skill when designing or evaluating the FSL scheduling engine architecture: optimization mode selection (Global/In-Day/Resource/Reshuffle), ESO adoption strategy, territory sizing for optimization, and fallback planning. Trigger keywords: FSL optimization engine, ESO enhanced scheduling, global optimization timeout, in-day optimization, OAAS architecture, territory optimization design. NOT for admin-level scheduling policy configuration, scheduling rule setup in Setup, or per-appointment scheduling API calls (covered by apex/fsl-scheduling-api).

agentforce-cost-optimization

8
from PranavNagrecha/AwesomeSalesforceSkills

Use when Agentforce run costs are climbing, you need to forecast scale, or you want to reduce tokens per conversation without hurting quality. Covers topic design impact on cost, prompt/template reuse, grounding size discipline, caching, and model-tier selection. Triggers: 'agentforce cost', 'tokens per conversation too high', 'reduce agentforce runs spend', 'forecast agentforce scale cost', 'einstein trust layer tokens'. NOT for general LLM pricing strategy outside Salesforce.

fsl-scheduling-optimization-design

8
from PranavNagrecha/AwesomeSalesforceSkills

Use this skill to design, configure, and troubleshoot the Field Service Lightning (FSL) Optimizer — including selecting optimization type (Global, In-Day, Resource Schedule), understanding the priority-score model, configuring travel mode (Aerial vs Street-Level Routing), and tuning optimizer behavior for specific scheduling objectives. NOT for configuring scheduling policies, work rules, service objectives weights, or the Dispatcher Console dispatch settings.

xss-and-injection-prevention

8
from PranavNagrecha/AwesomeSalesforceSkills

Use when writing or reviewing Visualforce pages, Apex controllers, or LWC components that output user-supplied data, build dynamic queries, or construct HTTP responses. Triggers: 'XSS in Visualforce', 'SOQL injection vulnerability', 'how to encode output in Apex', 'JSENCODE Visualforce', 'open redirect prevention'. NOT for Apex CRUD/FLS enforcement (use soql-security or apex-crud-and-fls), NOT for Shield encryption (use shield-encryption-key-management), NOT for AppExchange security review process (use secure-coding-review-checklist).

visualforce-security-and-modernization

8
from PranavNagrecha/AwesomeSalesforceSkills

Use when hardening or modernizing legacy Visualforce pages — covers the platform CSRF token model and when disabling it is a security regression, view state encryption guarantees and the 170 KB ceiling, FLS/CRUD enforcement gaps on `<apex:outputField>` and on getters that return sObjects, `<apex:includeScript>` interaction with the org Content Security Policy, hosting LWC inside a VF page via `lightning:container` / `lightning-out`, and the retire-vs-harden-vs-leave-alone decision for an inventory of legacy pages. Triggers: 'should I rewrite this Visualforce page in LWC', 'CSRF protection disabled on Visualforce page is that safe', 'community user sees a field they should not on a Visualforce page', 'view state encryption is that enough for sensitive data', 'how do I host an LWC inside a Visualforce page', 'apex:dynamicComponent and apex:actionFunction safe to keep'. NOT for greenfield Visualforce architecture (use apex/visualforce-fundamentals — controller types, view state pattern selection, PDF rendering); NOT for Visualforce email template authoring (use apex/visualforce-email-templates if/when that skill is authored); NOT for general Apex security review across triggers and async (use apex/soql-security and security/secure-coding-review-checklist).