Last active
November 17, 2019 00:36
-
-
Save MappingKat/21142fef5971027b64162e7e4ce160c6 to your computer and use it in GitHub Desktop.
block-2.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function createRecord(payload, done) { | |
payload.record = payload.data; | |
payload.record.form_id = "{FULCRUM SECOND FORM ID}"; | |
// if you have a field that does not have the same element key for both forms then you can associate the fields | |
// with this line (I explain what this is for in more detail in the next block): | |
payload.record.form_values['{FULCRUM ELEMENT KEY}'] = payload.record.form_values['{FULCRUM ELEMENT KEY 2}']; | |
delete payload.data; | |
delete payload.record.id; | |
request({ | |
method: 'POST', | |
url: 'https://api.fulcrumapp.com/api/v2/records.json', | |
json: payload.record, | |
headers: { | |
'X-ApiToken': '{API TOKEN}' | |
} | |
}, | |
function (err, httpResponse, body) { | |
console.log('create', err, body); | |
}); | |
done(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment