Skip to content

Instantly share code, notes, and snippets.

Last active Nov 17, 2019
What would you like to do?
function updateRecord(payload, done) {
payload.record =;
payload.record.form_id = '{FULCRUM SECOND FORM ID}';
// the line below equates the RECORDID() calculation field from the original form to the text field in the 2nd form
// so that we can use the query API to find the correct correct to update from the original form
payload.record.form_values['{FULCRUM ELEMENT KEY}'] = payload.record.form_values['{FULCRUM ELEMENT KEY 2}'];
var query = encodeURIComponent("SELECT _record_id AS fulcrum_id FROM \"Table Name\" WHERE my_record_id= '" + payload.record.form_values['FULCRUM ELEMENT KEY'] + "'");
request ({
method: 'GET',
url: '' + query,
headers: {
'X-ApiToken': '{API TOKEN}',
'User-Agent': 'request'
function (err, httpResponse, body) {
console.log(httpResponse, body);
body = JSON.parse(body);
if (body['rows'][0] && body['rows'][0]['fulcrum_id']){
method: 'PUT',
url: '' + body['rows'][0]['fulcrum_id'] + '.json',
json: payload.record,
headers: {
'X-ApiToken': '{API TOKEN}'
function (err, httpResponse, body) {
console.log('PUT', err)
console.log('PUT', body);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment