I am looking for looping pipe response in Javascript. The response of pipe is array of objects I need to use the response object’s data for further processing.
Case :
Result is from users table. I have connection with ABC table.
I want to show users who are not present in ABC table for particular date(daily activity).
function getAllConnectedRecordsAndUpdateTheEmptyRecords(){
// First, we run the Filter by a Single Field pipe
TB.triggerPipe('eyJpdiI6IjNEY...', {
tableId: 'lGArg7rmR6',
fieldId: 'field_33',
operator: 'is',
value: '{pageField.Record ID}'
},
function (type, response, xhrRespone) {
console.log('pipe response', type, response, xhrRespone);
// Now that we got all connected records, we'll loop through each one and call the Update Existing Record pipe
response.items.forEach(item => {
if (item.field_32 === "") { // IF field_32 is blank
// Trigger the Update Existing Record pipe
TB.triggerPipe('eyJpd...', {
tableId: 'lGArg7rmR6',
field_id: 'field_32',
field_val: 'This record was empty',
recordId: item.id
},
function (type, response, xhrRespone) {
console.log('pipe response', type, response, xhrRespone);
$('#x_element_page_8_4 > div.table-responsive.table-outer-wrapper > div.table-actions.no-print > div.pull-left.form-inline > button').click();
}
);
}
});
}
);
}
TB.render('component_5', function(data) {
$('#update-connected-blank-records').click(function(){
getAllConnectedRecordsAndUpdateTheEmptyRecords();
});
});
@Chem hi, very interesting, another way to load JS and pipes. However I checked my pipes in some of my builders, and I don’t have the option to “copy” the pipe code to insert in the JS window page. Maybe is there something missing?
Hey @Aprada, I’ve enabled Pipe JS for your account. If anyone else wants this feature enabled for their account, don’t hesitate to get in touch with support.