|
1 | 1 | # @openfn/language-salesforce |
2 | 2 |
|
| 3 | +## 5.0.0 |
| 4 | + |
| 5 | +Major modernization of the Salesforce adaptor, focusing on standardized state |
| 6 | +handling (ie,`state.data` over on `state.references`) and a cleaner API. |
| 7 | + |
| 8 | +This version introduces multiple breaking changes and workflows WILL require |
| 9 | +changes to be compatible - see the Migration Guide. |
| 10 | + |
| 11 | +### Migration Guide |
| 12 | + |
| 13 | +- Operations now "return" their results to `state.data`. Use `state.data` |
| 14 | + instead of `state.references`. For example: |
| 15 | + |
| 16 | +```js |
| 17 | +❌ retrieve('Patient__c', $.patientId); |
| 18 | + fn((state) => { |
| 19 | + state.patients = state.references.at(-1) |
| 20 | + return state |
| 21 | + }); |
| 22 | + |
| 23 | +✅ retrieve('Patient__c', $.patientId); |
| 24 | + fn((state) => { |
| 25 | + state.patients = state.data; |
| 26 | + return state |
| 27 | + }); |
| 28 | +``` |
| 29 | + |
| 30 | +- All callback functions have been removed. Use `fn()` blocks or `.then()` |
| 31 | + functions instead. For example: |
| 32 | + |
| 33 | +```js |
| 34 | +❌ query($.query, {}, (state) => { |
| 35 | + state.patients = state.references.at(-1) |
| 36 | + return state |
| 37 | + }); |
| 38 | + |
| 39 | +✅ query($.query).then((state) => { |
| 40 | + state.patients = state.data; |
| 41 | + return state |
| 42 | + }); |
| 43 | + |
| 44 | +✅ query($.query) |
| 45 | + fn((state) => { |
| 46 | + state.patients = state.data |
| 47 | + return state |
| 48 | + }); |
| 49 | +``` |
| 50 | + |
| 51 | +- The `axios` object has been removed. For HTTP requests outside salesforce, use |
| 52 | + a different step with the http adaptor |
| 53 | +- Replace `describeAll()` with `describe()`. |
| 54 | +- Replace `upsertIf(...)` with `fnIf(true, upsert(...))` |
| 55 | +- Replace `createIf(...)` with `fnIf(true, create(...))` |
| 56 | +- Replace `toUTF8(...)` with `util.UTF8(...)` |
| 57 | +- The `bulk()` signature has been re-ordered: replace |
| 58 | + `bulk(operation, sObject, options, records)` with |
| 59 | + `bulk(operation, sObjectName, records, options)` |
| 60 | + |
| 61 | +### Major Changes |
| 62 | + |
| 63 | +- 59721be: New API design for salesforce, including use of `composeNextState` |
| 64 | + and removing old code. |
| 65 | +- Remove `axios` dependency |
| 66 | +- Remove old/unused functions. `relationship`, `upsertIf`, `createIf`, |
| 67 | + `reference`, `steps`, `beta`, `describeAll()` |
| 68 | +- Standardize state mutation in all operations |
| 69 | +- Change `bulk` signature to `bulk(operation, sObjectName, records, options)` |
| 70 | +- Remove callback support |
| 71 | +- a2cf9c7: Move `toUTF8()` to `util.UTF8()`. `toUTF8` is not an operation and |
| 72 | + cannot be called at the top level. Moving into the utils namespace should help |
| 73 | + make the usage of the function a little clearer |
| 74 | +- ca09ade: - Restructured response format for `bulk`, `create`,`update` and |
| 75 | + `destroy` functions into standardized result structure: |
| 76 | + ``` |
| 77 | + { |
| 78 | + success: boolean, |
| 79 | + completed: [id], |
| 80 | + errors: [{ id message }], |
| 81 | + } |
| 82 | + ``` |
| 83 | +- b1227a2: - add `query` option in `request` function |
| 84 | + |
| 85 | +### Minor Changes |
| 86 | + |
| 87 | +- b4a9c42: - Create `get()` and `post()` functions for all http requests against |
| 88 | + Salesforce |
| 89 | +- Update `describe()` to fetch all available sObjects metadata |
| 90 | +- update function examples and improve options documentation |
| 91 | +- Enforce that `upsert`, `create` and `update` do not accept dot-notated |
| 92 | + relationships. Relationships should be nested instead. Eg, do this: |
| 93 | + ``` |
| 94 | + create('Project', { |
| 95 | + "Project__r": { |
| 96 | + "Metrics_ID__c": "value" |
| 97 | + } |
| 98 | + }) |
| 99 | + ``` |
| 100 | + Not this: |
| 101 | + ``` |
| 102 | + create('Project', { |
| 103 | + "Project__r.Metrics_ID__c": "value" |
| 104 | + }) |
| 105 | + ``` |
| 106 | +- Add support for nested relationships in `bulk` (the adaptor will flatten them |
| 107 | + to dot-notation for you) |
| 108 | + |
| 109 | +### Patch Changes |
| 110 | + |
| 111 | +- b4a9c42: - Change internal `cleanupState` to `removeConnection` and tagged it |
| 112 | + as private function |
| 113 | + - Rename `attrs` to `records` in docs |
| 114 | +- Update `@openfn/language-common` to `workspace:*` |
| 115 | +- Add integration tests |
| 116 | + |
3 | 117 | ## 4.8.6 |
4 | 118 |
|
5 | 119 | ### Patch Changes |
|
0 commit comments