AJ! I should send this over teams too so check there but here is an idea you could try.
utils.confirm({
title: 'Please Confirm',
description: 'Are you sure you want to take the specific action?',
acceptLabel: 'Confirm',
cancelLabel: 'Cancel',
onConfirm: () => {
// Code to execute if the user confirms
console.log('Confirmed!');
// Place your action code here
},
onCancel: () => {
// Code to execute if the user cancels
console.log('Cancelled');
}
});
You may be able to trigger a modal or confirmation prompt using utils.showNotification or utils.confirm, but utils.showConfirmation is not a built-in function. To achieve the desired behavior, you can use utils.confirm for a simple confirmation dialog. If you try this out Iām interested in hopping on a call and seeing your use case.
Ay carumba...is utils.confirm seriously a utility included in Retool and this whole time I just missed it!? Haha I was aware that utils.showConfirmation is not an available utility which is why I had it in Feature Requests, I just wanted to be able to have access to something like the sweetAlert2 library so we could designate confirmations as well as other notification types with a simple JS method natively usable from the utility level.
But it sounds like it may already exist? I'm blown away I never noticed it I've built a confirmation modal previously, but wanted to be able to do it without self-built custom logic. I'm gonna look into utils.confirm though! Thanks man!
That would be awesome! There are occasions where I'd want to pop a confirmation like a notification during a process within a JS Query where advanced settings in a query wouldn't be conventional. Let me know if this gets added and thanks for the reply @Darren!!!
Hi @Darren - when the user clicks "cancel" on the confirmation, is there any way to return that back as the result of the query? I think it currently just doesn't execute. Would be much better if the "cancel" would send something back that you can use in a branch. For example, if changing a switch value would trigger a query that maybe a user doesn't want to trigger, it would be great if clicking "cancel" on the notification would send something back that would let me re-set the switch.