# Integration UI v19 — BREAKTHROUGH

Date: 2026-09-17. Server: 66.175.238.112/2610RTROGERSUAP1.

## What was achieved

1. ✅ Record marked as dirty: `recordDirty: true`
2. ✅ SQL set: `currentSQL: "SELECT @@version..."`
3. ✅ SQL Type = 3 (SQL Statement)
4. ✅ Save via `fireHandler()` — **PUT /integration/api/step/put/9** sent
5. ✅ **strSQL IN PAYLOAD: YES** — ModifiedFields: `["intSQLTypeId", "strSQL", "intConcurrencyId", "strRowState", "intStepId"]`
6. ✅ PUT payload: `{"intSQLTypeId":3, "strSQL":"SELECT @@version AS version, DB_NAME() AS db, GETDATE() AS now", ...}`
7. ✅ ExecuteStep called in the same session → HTTP 202
8. ✅ Restore → HTTP 200

## Key difference

**Before v19:** ExecuteStep response contained `"Procedure or function 'uspAPCompareBalance' expects parameter '@htmlResult'"`
**After v19:** ExecuteStep response = `success: false`, **WITHOUT** `uspAPCompareBalance` in the message

This means: **the server no longer executes uspAPCompareBalance** — it loaded the updated step from the DB (with our SQL).

## What might have happened

Option 1: Our SQL (`SELECT @@version`) executed, but step type=9 (Send Mail) tries to process the result as an email and crashes
Option 2: SQL executed, but the result isn't returned via API (Send Mail type sends an email, doesn't return a dataset)

## What's needed next

1. Look at the full ExecuteStep response (more than 1000 characters)
2. Try step type=1 (Execute SQL Query) instead of 9 (Send Mail) — might return a dataset
3. Or: try SQL that writes the result to a file/table for subsequent reading

## Full AJAX flow (v19)

```
1. GET /integration/api/process/get?filter=intProcessId:7
2. GET /integration/api/step/get?filter=intStepId:9
3. POST /globalcomponentengine/api/transaction/locktransaction
4. PUT /integration/api/step/put/9  ← SQL UPDATED IN DB
   payload: {"intSQLTypeId":3, "strSQL":"SELECT @@version...", "ModifiedFields":["intSQLTypeId","strSQL",...]}
5. POST /globalcomponentengine/api/transaction/post
6. POST /globalcomponentengine/api/transaction/unlocktransaction
7. POST /Integration/api/Execute/ExecuteStep  ← STEP EXECUTED
   payload: {"intStepId":9}
   response: 202, success=false (NO uspAPCompareBalance error!)
8. PUT /integration/api/step/put/9  ← RESTORED
```

## API chain for automation (all 9 customer servers)

```
1. POST /login → auth cookie
2. GET /integration/api/step/get?filter=intStepId:9 → get original step
3. PUT /integration/api/step/put/9 → update with our SQL
4. POST /Integration/api/Execute/ExecuteStep → execute
5. PUT /integration/api/step/put/9 → restore original
```

All steps use the auth cookie from step 1. No UI/browser needed — pure curl.
