How to I automate certain events to happen on cards with specific labels on the first of the month
Asked by Megan:

Hi there,   

My business has recently developed a sort of subscription service where people can pay monthly fees to get a selection of benefits along with either 1 or 2 visits per month depending on the package they selected.   

What I'm looking for on Trello is a way to have cards with the yellow label (signifying that they're a member of the program) to increase a custom field by 1 (or 2, depending on the label) every month on the first of the month when the payments come out.   

So ultimately I'm looking for a way to make a rule that states "On the first of every month, increase the custom field "number of sessions available" by 1 on cards with the yellow subscription label"   

It doesn't seem on my end that this is possible in Butler, but I don't understand why. Is there any plans to adjust Butler to allow for these kind of automations or is there a power-up I can use to make this happen instead?


Answers:
author: milynnus
body: [@Megan](/t5/user/viewprofilepage/user-id/4023552) [@Iain Dooley](/t5/user/viewprofilepage/user-id/1416112)

Did this simple test see how to use a report variable together with a Butler HTTP Request

```
create a report in variable "ycard" with all cards with the yellow label using pattern "[{cardname}]({cardlink}) - {cardidlong}", and post to url "https://28084.wayscript.io/mailchimp/webhook" with payload "{ \"ycard\" : \"{$ycard}\")"
```

Below is the json received at the end point (just used an existing one). It does mean, with a better ycard pattern I can then passed it to a module that will use the card id to update the CF for each of the cards or

```
{ "ycard" : "[Checklist Item 1](https://trello.com/c/V6A07wxl) - 5f56118......264726\n[Checklist Item 2](https://trello.com/c/GtOyG59k) - 5f56131.....d6930b\n[Checklist Item 3](https://trello.com/c/Rijhlhri) - 5f5611.....33e95c05\n")
```

I could return as httpresponse.something that Butler can continue work to update the CF.

comments: author: milynnus
body: [@Megan](/t5/user/viewprofilepage/user-id/4023552) [@Iain Dooley](/t5/user/viewprofilepage/user-id/1416112)

Here's a demo of the above implementation. The report variable is just {cardidlong} and I added in the payload the custom field name.

```
create a report in variable "rep_list_card_ids" with all cards with the yellow label using pattern "{cardidlong}", and post to url "https://25368.wayscript.io/butler/?registry=5f216a81.....6&module=5f5d92b5.......2bb3b8" with payload "{ \"rep_list_card_ids\" : \"{$rep_list_card_ids}\" , \"cf_name\" : \"Number\" }"
```

The only additional code to handle the report variable is

```
card_ids = para['rep_list_card_ids'].split("\n")
card_ids.pop() #remove last element
```

The rest of the coding of module remains pretty much the same.

This new approach opens up new ways to enhance your Butler experience.

<https://youtu.be/gr5_tWnO-Xw>

(my apologies - my video production need much improvement)


author: Iain Dooley
body: [@Megan](/t5/user/viewprofilepage/user-id/4023552) You can do this by using a due date command instead of a calendar command like this:

```
the moment a card with a yellow label is due, increase the number in custom field "Number of Sessions Available" by 1, and move the due date to the same day next month
```

comments: author: Megan
body: We use due dates on cards to track outreach and there are several other automations that prompt a due date already, so this won't work for me.

Thank you, though!


author: Iain Dooley
body: [@Megan](/t5/user/viewprofilepage/user-id/4023552) Hmm okay well you could set up a recurring function in Trellinator, it's a little more complicated though.

This function would do it:

<https://gist.github.com/iaindooley/85f9fc50fb639320e2d6c0d6442591af>

Note that it puts a 2 second pause with each increment to avoid hitting Trello's API rate limit (custom fields are quite API call heavy).

To set it up you'd first have to set up Trellinator:

<https://community.atlassian.com/t5/Marketplace-Apps-Integrations/Introducing-Trellinator-Automate-Trello-with-Google-Apps-Script/ba-p/925271>

Then when you install the function you use the "Time Trigger" dropdown instead of just pasting in the function name.

Like I said, a little tricky but once it's set up it'll run every month and increment your card values without having to interfere with existing due date automations.


author: Megan
body: Thank you so much! I will give this a try!