Using promises
📜 This job is an official example from OpenFn.
Metadata​
- Name: Using promises
- Adaptor:
@openfn/language-salesforce
- Adaptor Version:
latest
- Created date unknown
- Updated date unknown
- Score: 100 (an indicator of how useful this job may be)
Key Functions​
query
Expression​
// Example with language-salesforce
fn(state => {
// return state => {
return new Promise((resolve, reject) => {
query('SELECT Name FROM Account')(state)
.then(state => {
console.log(state.references[0].records);
console.log('doing stuff here');
return state;
})
.then(state => {
console.log('and in here');
resolve(state);
});
});
// };
});
fn(state => {
console.log('and also in here!');
console.log(state.references);
return state;
});