Add dialog to script to email

168 views
Skip to first unread message

Graham Wood

unread,
Aug 11, 2025, 4:04:23 AMAug 11
to mementodatabase
I have a diabetes database in working on for my partner and would like to be able to tap an action button when the library is opened and it pops up a dialog asking the start and end dates and when ok is selected it puts them in an email to send to the Dr.
Here is a link to the DB


Thanks in advance 

David Gilmore

unread,
Aug 11, 2025, 11:13:54 AMAug 11
to mementodatabase
You can do this using Zapier or using a Memento "rule".

It is a little bit  of a complex procedure, but fortunately Google's AI does a decent job of describing how to do it.

Google "memento database generate email" and observe what the AI says.

Hope this helps!

Er Mo

unread,
Aug 11, 2025, 2:29:53 PMAug 11
to mementodatabase
Hallo
Mit einer Regel geht es einfach . Du musst aber zuerst die " Standartdaten " für die E Mail eingeben . So das Memento weiß von Wo die Meil zusenden ist .

Hello
It's easy with a rule. However, you first have to enter the "standard data" for the email. This way, Memento knows where to send the email.

Ernst

Mmm

unread,
Aug 11, 2025, 4:52:00 PMAug 11
to mementodatabase
Вариант решения.
Если дата окончания периода не указана в аргументах скрипта действия в библиотеке - она равна текущей дате.
Результат выводится в окно диалог для визуализации решения.
Для отправки сообщения необходимо изменить код.
Если почтовых адресов несколько, можно доработать окно диалог и добавить в него выбор почтового адреса из выпадающего списка.

Шаблон с примером:

понедельник, 11 августа 2025 г. в 21:29:53 UTC+3, ernst...@gmail.com:
IC__11082025.jpg

Graham Wood

unread,
Aug 11, 2025, 6:32:32 PMAug 11
to mementodatabase
Thanks Mmm, can I re enable the email so it sends the email or is there something else to do to send it. Its only going to 1 email

Mmm

unread,
Aug 12, 2025, 12:04:10 AMAug 12
to mementodatabase
Нужно изменить комментарии...
Шаблон во вложении.

вторник, 12 августа 2025 г. в 01:32:32 UTC+3, grahamsc...@gmail.com:
BloodGlucose2.mlt2

Graham Wood

unread,
Aug 12, 2025, 2:46:41 AMAug 12
to mementodatabase
Thankyou Mmm perfect as usual. I was using ChatGPT to try and do what you did but it kept getting it wrong every time.

Amayada

unread,
Aug 26, 2025, 12:29:13 AMAug 26
to mementodatabase

Hello everyone!  I've been following this thread posted by Graham, and the solution provided by Mmm fits well with what I've been trying to do.  But I think I'm a bit stuck.

As a background, I'm trying to create a database for our cooperative that stores different transactions by our clients.

What I would like to happen is that the email that would be sent will contain the necessary transaction information according to that client and according to the dates chosen.  Presently, the solution sends all the transactions that are saved.  Any help, please?  Also, suggestions on how to improve the library/ies is very much welcome as this is my first foray into an accounting database (maybe fields for sum of deposits, withdrawals, total account of activities of the client, etc.)

Thank you in advance!  

Amayada

unread,
Aug 27, 2025, 11:05:29 AMAug 27
to mementodatabase
I think I kinda figured it out ..  I revised Mmm's code a little to filter out the details per ID number, but I need more dummy details to test it out.  But, how do I place the "To:" recipient email automatically?

Graham Wood

unread,
Aug 27, 2025, 6:36:37 PMAug 27
to mementodatabase
if its the same script that Im using look in the select dates action script and the very first line is this ( just change it to the address you require)
let mail = 'PUT YOUR EMAIL HERE';

Amayada

unread,
Aug 27, 2025, 11:50:15 PMAug 27
to mementodatabase
Hello sir!  Yes!  It was bad for me not to notice that part.  Thanks!

Amayada

unread,
Aug 28, 2025, 12:26:59 AMAug 28
to mementodatabase
Oh no!  I thought I had it, but it didn't work.

Here's the borrowed script I'm working with that I need help:

let e = entry();
let mail = e.field("Email address");
let id = e.field("URCC ID number");

//Here's the code provided by Mmm
let start = arg('start date');
let end = arg('end date');

if (moment.isDate(start)) {
   start = moment(start).startOf('d);
if (moment.isDate(end)) {
   end = moment(end).endOf('d');
   } else {
   end = moment().endOf('d');

//Here's where I tried to modify

let entries = lib().entries();

if (entries.length > 0) {
   let uid = e.field('URCC ID Number');
   let transaction = entries.filter(item => item.field('URCC ID Number') === uid && item.id !== e.id);
   let list = transaction;

   let filter = entries.filter(a => moment.isDate(a.field('DateTime')) && moment(a.field('DateTime')).isBetween(start, end, undefined, transaction));

   if (filter.length > 0) {
     if (filter.length > 1) {
       filter = filter.sort((a,b) => moment(a.field('DateTime')).isAfter(b.field('DateTime')));
       }

for (let ee of filter) {
    list.push(addLine(ee));
}

//The rest of the code is for sending an email 
Reply all
Reply to author
Forward
0 new messages