Action Buttons - Update Records event listeners

We have added two event listeners for Action Buttons Update Record action.

update-record-success event with field values is triggered after getting a response with a success status.
update-record-failure event is triggered after getting a response with an error status.

window.addEventListener('update-record-success-list1', (e) => {
	// e.detail is an object with updated field names and values
	console.log('update record success', e.detail);
	// update record success { 
	//                   payload: { "Full Name": "Softr" ... },
	//                   id: "rec123456"
	//                 }
});

window.addEventListener('update-record-failure-list1', (e) => {
	console.log('update record failure', e.detail);
	// update record failure 'Email field is required.'
});

// To reload the page after record update on #list1 block
window.addEventListener('update-record-success-list1', () => {
	window.location.reload()
});
4 Likes

Thank you so much for the update! :wink:

For “add record” action buttons, should I use ‘submit-form-success-formX’ and ‘submit-form-fail-formX’ as event listeners or ‘add-record-success-listX’ and ‘add-record-success-listX’?

Hi @artur, are there also click events we can track more generally (independent of what kind of action button it is) for the new action buttons?

@matthieu_chateau it’s still a form-submit...

@vonperger we will be adding selectors to buttons to track those too. Do you need generic click handler on action buttons ?

hi @artur thanks for looking into this. I would like to add stuff like calling fathom events or make.com webhooks etc when someone clicks on a button (mouse over might also be an interesting event). Ideally the generic list click (not the action button) would also have a selector. Thank you!

@artur Could you share what is the event listener for add-record-success action buttons?

Hi Rebecca,
This should work: replace update-record-success-list1 by submit-form-success-listX

That works - thanks!!

Hi, would it be possible to have event listeners for Open URL action buttons on list block ?
I use webhooks URLs from Make and would like to use custom code to add logged-in user data (email and full name) in the data sent to Make.