Butler script for emailing custom field date
Asked by C. Travis Webb:

I've searched the boards but can't find an answer for my exact issue.

I'm trying to get Butler to send an email report based on a Custom Field date. I've attached the script below. Not sure what I'm missing. I followed Trello's example [here.](https://help.trello.com/article/1192-creating-reports-with-butler)

However, that script is setup to send a report based on the buckets Doing ({$Doing}) and Done ({$Done}). I want it to send a report based on the entire board.

I've tried a variety of commands in the last line, but none of them seem to work. Right now it says "sourcecardname," but I've tried many varieties.

The emails will send, and they're formatted properly, but there's no content. No card, no link, no dates.

Obviously I'm doing something wrong. Just not sure what it is. Any help would be greatly appreciated.

Here's the script

every monday at 7:00 am, create a report with all cards with custom field "Reminder Date" set to a date in this week using pattern "- \[{cardname}\]({cardlink}) =\> {{%Reminder Date}}", and send an email notification to "name@url.com" with subject "Reminders for this week" and message "Reminders:\\n\\n{sourcecardname}"


Answers:
author: Iain Dooley
body: [@C. Travis Webb](/t5/user/viewprofilepage/user-id/3567517) I've not worked with Butler reports, but if you look at their example it appears that the default "report variable name" is "{$report}". Here is their sample:

```
every friday at 11:45 pm,create a report with all cards in list "Done",and send an email notification to every member of the boardwith subject "Weekly Report for week #{weeknumber}"and message "{$report}
```

See how the message has a variable in it called "{$report}"? Your message has "Reminders:\\n\\n{sourcecardname}".

The other example they give is:

```
every friday at 11:45 pm,create a report in variable "Doing"with all cards in list "Doing"using pattern "- [{cardname}]({cardlink}) ({cardmemberusernames}) {{%Priority}} => DUE on {cardduedate}",create a report in variable "Done" with all cards in list "Done"using pattern "- [{cardname}]({cardlink}) ({cardmemberusernames}) {{%Priority}} => DONE on {{%Completion Date}}",and send an email notification to every member of the boardwith subject "Report for week #{weeknumber}"and message "Doing:\n\n{$Doing}\n\nDone:\n\n{$Done}"
```

In this case, they have created a report "in variable", meaning that rather than using the default variable name "{$report} for the report content, the variables used in the message template will now be held in {$Doing} and {$Done}.

So based on that, I would say your command should be:

every monday at 7:00 am, create a report with all cards with custom field "Reminder Date" set to a date in this week using pattern "- \[{cardname}\]({cardlink}) =\> {{%Reminder Date}}", and send an email notification to "name@url.com" with subject "Reminders for this week" and message "Reminders:\\n\\n{$report}"

Let me know if that works!

comments: author: C. Travis Webb
body: Thanks very much for the assist, and the explanation! It's appreciated. I'll try it out this weekend and let you know.


author: C. Travis Webb
body: Meant to post this last week... Thanks Iain! That worked perfectly. Appreciate the script, and especially the explanation. Very helpful for future attempts.


Tags: butler