Butler - How to pull due date from title while also modifying title?
Asked by Olivia Henao:

Hi, we are currently using email-to-board to manage incoming requests from a form. When the request gets emailed into Trello, I set up a rule to rename it and add a label:

```
when a card with a name starting with "New Marketing Request - {*} - {*} - {*} - {*}" is emailed into the board, rename the card to "{wildcard1} - {wildcard2}", and add the sky "Request" label to the card
```

And another that pulls the date from the title and makes it the due date on the card  

```
when I enter a card name containing a date, set due on the date and remove the matched text
```

However, I recently ran into an issue where I wanted to name a card "Ad - 1/2 page" and it kept thinking the 1/2 was a date. I only want it to pull the date from these emailed in cards. Unfortunately there is no emailed into option for that trigger, so I played with wildcards a bit but realized I don't think commands necessarily run in the same order every time? So can I combine into one rule?

```
when I enter a card name containing a date after "New Marketing Request - {*} - {*} -", set due on the date and remove the matched text, rename the card to "{wildcard1} - {wildcard2}", and add the sky "Request" label to the card
```

But so far I'm not having much luck... it's not catching the cards like the "when a card with a name starting..." trigger would. Would appreciate any insight!


Answers:
author: Hannah Humbert - Simpla Workflows
body: Hi [@Olivia Henao](/t5/user/viewprofilepage/user-id/4835218) ! Just to confirm, you're wanting to add a condition to your rule "when I enter a card name containing a date..." command so that it *only* applies to the cards created from email. Is that right?  

It's not possible to add a condition to that particular trigger. My first thought would be to use a different user for your email-to-board settings - like a service account. Then, create the date command logged in as the service account. The command says "when I enter a card name..." so that means it will only apply when the service account creates cards AKA when cards are created from email.

comments: author: Olivia Henao
body: Hi Hannah! That is actually in the plans for the future, because right now I have created all of our automations and they're tied to my account, so if I were out or left my team would be in a bit of trouble haha.

In the meantime however I was hoping to get this working with my account... was my last attempt not looking possible? This one:

```
when I enter a card name containing a date after "New Marketing Request - {*} - {*} -", set due on the date and remove the matched text, rename the card to "{wildcard1} - {wildcard2}", and add the sky "Request" label to the card
```

Because all the cards that get emailed in that I want to apply this to have the same subject format - "New Marketing Request - {Department} - {Need} - {Date} - {Request Number}" so I thought that would help capture them, which it did when I was just renaming them, but I'm struggling with the due date trigger.


author: Hannah Humbert - Simpla Workflows
body: [@Olivia Henao](/t5/user/viewprofilepage/user-id/4835218) I think the only way it'd work in that case would be if your format was something like: "New Marketing Request - {Date} {Department} - {Need} - {Request Number}"  

Then, your command could say:  

```
when I enter a card name containing a date after "New Marketing Request -", set due on the date and remove the matched text, and add the sky "Request" label to the card
```

<br />

So if your card title was "New Marketing Request - 7/15 Create Blog Post - Sales - 1234", the command will set the due date to July 15 and rename the card to "Create Blog Post - Sales - 1234".  

The "matched text" in this case is "New Marketing Request - 7/15" so that part of your title would be removed.   

If your trigger says:  

```
when I enter a card name containing a date after "New Marketing Request - {*} - {*} -"
```

<br />

Then the matched text would be everything up until the date so the department and need would be removed from the title.


author: Olivia Henao
body: Hi [@Hannah Humbert - Simpla Workflows](/t5/user/viewprofilepage/user-id/2109993) sorry for the delayed reply.

So it seems the issue is that the due date match relies on being at the beginning of a string?

I tried another route, trying to pull the date from the description instead of the title:

```
when I enter a card description containing a date after "Needed By:", set due on the date
```

The "Needed By:" is not at the beginning of the description either. It hasn't been working for the most part, though oddly it worked today on one instance... the only difference I can see is the "Needed By:" wasn't bold? Should that affect it?  

ETA: Played with that idea and tried to use Regex to capture both, but that doesn't seem to be helping lol...

```
when I enter a card description containing a date after "regex:/.*(Needed\sBy:|\**Needed\sBy:\**).*/", set due on the date
```


author: Hannah Humbert - Simpla Workflows
body: [@Olivia Henao](/t5/user/viewprofilepage/user-id/4835218) I don't think the due date match needs to be at the beginning of the string. It could be anywhere in the title. You just need to make sure you're removing the correct matched text. In the original command you shared, the matched text contained the department and need, so it would remove this information in that case.   

For example, if your title was:  

{Department} - {Need} - New Marketing Request - {Date} {Request Number}  

Your command could say "when I enter a card name containing a date after "New Marketing Request -"  

When Trello removes the matched text, your title would be left with:  

{Department} - {Need} - {Request Number}  

So the matched text that's getting removed is just "New Marketing Request - {Date}"  

<br />

For your other command with the description, it could be that you need to include the markdown formatting like you've started experimenting with - so try "...containing a date after "\*\*Needed By:\*\*"  

You might have to create two separate rules to account for the text being bold. Not sure if regex would work in this case ?  

<br />


Tags: butler

due-date

rename

rule