> For the complete documentation index, see [llms.txt](https://learning.contextqa.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://learning.contextqa.com/packaged-application-testing/packaged-app-testing/cross-system-lead-to-cash.md).

# Cross-System Lead-to-Cash

Design cross-system lead-to-cash tests that reconcile Salesforce opportunities with ERP orders, fulfillment, invoices, and returned status.

> **Documentation owner:** [Deep Barot](https://contextqa.com/academy/) · **Last updated:** November 12, 2026

## Quick answer

Validate lead-to-cash by linking a Salesforce commercial event to the selected ERP order, fulfillment, invoice, and returned status using stable correlation keys. Test each system’s result and the integration boundary, including retries, partial completion, and failures. Choose SAP or Oracle according to the actual architecture; do not assume both are present.

## Key takeaways

* A source-system success is not proof of downstream completion.
* Use actual integration contracts and stable business correlation keys.
* Verify retries and partial failures without creating duplicate business effects.

## Map the real architecture

Document source event, middleware or integration route, transformation, authentication, destination product/module, asynchronous status, and return path. Mark which interfaces are directly testable and which require an approved stub or external evidence. A stub validates its defined contract, not the real downstream application.

## Build the complete journey

1. Prepare a synthetic customer, product mapping, pricing assumptions, and authorized roles across Salesforce and the selected ERP.
2. Create and approve the Salesforce opportunity or quote using the applicable [Sales Cloud](/packaged-application-testing/salesforce-testing/sales-cloud-crm.md) or [CPQ](/packaged-application-testing/salesforce-testing/revenue-cloud-cpq.md) guide.
3. Capture the source record and business correlation key. Trigger the configured integration and record request/message identity.
4. Verify the destination order uses the correct customer, items, quantities, amounts, currency, and source references. Use [SAP order-to-cash](/packaged-application-testing/sap-testing/order-to-cash.md) or [Oracle order-to-cash](/packaged-application-testing/oracle/order-to-cash.md).
5. Fulfill the controlled order and verify shipment/delivery, invoice, and agreed financial handoff. Preserve all document references.
6. Verify the returned ERP status and invoice reference in Salesforce where that return integration is in scope.
7. Reconcile the entire chain: one intended commercial event, the expected order/line mappings, correct quantities and amounts, and no unexplained duplicate effects.
8. Reset or reverse run-owned records through the approved business procedures. Do not independently delete accounting or stock records to make the next run easy.

## Exercise integration failures

| Case                             | Expected assertion                                                  |
| -------------------------------- | ------------------------------------------------------------------- |
| Customer/product mapping absent  | Explicit rejection or exception queue; no wrong customer/item order |
| Integration times out            | Traceable pending/failure state and bounded recovery behavior       |
| Same event retried               | Contract-defined idempotency or duplicate rejection                 |
| Partial shipment                 | Remaining quantity, invoice amount, and returned status agree       |
| Unauthorized or expired identity | Access fails visibly; no false completed state                      |
| Source amended after handoff     | Approved change/cancel policy preserves both systems’ consistency   |

## Demonstrate release confidence

Show a current successful chain and a failed boundary with its evidence. Identify which custom-code changes use PR impact analysis and which ERP configuration/vendor changes require separate review. Keep pending integrations and missing role coverage in the release decision.

## Frequently asked questions

### Is this a prebuilt Salesforce-to-SAP or Salesforce-to-Oracle connector?

No. It is an end-to-end test-design recipe using your configured integration and supported test interfaces. Record the middleware/service contracts and validate them before labeling the pack ready.

### Can an agent generate the integration tests?

It can draft cases from reviewed contracts and business invariants. Follow the [agentic workflow](/packaged-application-testing/packaged-app-testing/agentic-asset-workflow.md) and verify runtime identifiers, final records, and negative cases through actual execution.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://learning.contextqa.com/packaged-application-testing/packaged-app-testing/cross-system-lead-to-cash.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
