It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Butler: cascade due date update to first attachment only if the new due date is before the existing

Hi! Not sure if this has been asked before, or where to look for such information. I would like to setup a main card, which is linked with 2 "sub-cards".  For example, let's take an example:

 

  • Main Card: Kitchen Remodel
  • Sub Card 1: Get quote from John
  • Sub Card 2: Get quote from Paul

 

I would link Sub-Card1 (two-way) and Sub-Card2 (two-way) to Main Card. Then, I would like to setup some kind of automation to do the following.

  • I would like that if Main Card has no due date, and then if I set SubCard1 due date to 15 Nov, this is cascaded as the Due Date for Main Card. 
  • Then, if I set SubCard2's due date is set to 10 Nov, this re-cascades MainCard's due date to 10 Nov.
  • If however, I then update SubCard1's due date to 20 Nov, this is not cascaded because it is after the existing due date of 10 Nov. 

Is a rule like this possible via Butler, or any other automation method?

 

Regards,

Karl

1 answer

0 votes
Iain Dooley Community Leader Nov 07, 2019

@karlcassar the creation of the sub-tasks is easy with Butler or Trellinator, I wrote about it here:

https://community.atlassian.com/t5/Trello-articles/Trello-Subtasks-with-Butler/ba-p/1060392

The cascading due dates won't be possible with the Butler power up (it might have been doable with the Butler Bot which has been phased out ...) but here is a Trellinator function that will do what you need:

https://gist.github.com/iaindooley/7ba28b44ffe78a845631341a078ddfb6

This assumes the linking is done in the same fashion above (ie. parent cards linked in attachments, children linked in a checklist).

You can read more about Trellinator here:

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

Honestly, this looks very powerful albeit it's a bit overkill for what I need. However its very interesting to know that google scripts can be used for this. I tried to set it up briefly and the tutorial worked.   I copied the function, and added it. It seems to be called ok, however then there is an error in log:



["Examining Notification: [5dc58c0afce1b08bf30f0b4e-updateCard]","Yes, this is a board level notification...","Processing notification for board: Test Board [5dc587f6124f847952ed72e0]","executing realtime function: setMainCardDateToEarliestSubCardDate","Test Board [5dc587f6124f847952ed72e0]setMainCardDateToEarliestSubCardDate\n54c285f93abd4835b6621b3f967a66d3","function: setMainCardDateToEarliestSubCardDate TypeError: Cannot find function toUTCString in object 2019-11-04T11:00:00.000Z.","Now coming to Global Commands..."]

Couldn't determine where is the 'toUTCString'. 

Iain Dooley Community Leader Nov 08, 2019

@karlcassar oops the setDue command expects a date object, but the due() method of the card returns a UTC string. It's an idiosyncrasy that harks back to the early days of development that I can't easily change in a backwards compatible fashion (ie. ideally I should change it so that the due() method returns a Date object too but there's probably a tonne of stuff that would break as a result :)

And yes using Google Apps Script to automate Trello is incredibly powerful. The early roots of Trellinator are in the work of another Ian (albeit of inferior spelling):

http://www.littlebluemonkey.com/blog/pimp-your-trello-cards

Iain Dooley Community Leader Nov 08, 2019

@karlcassar note that I've updated the gist with corrected code and tested it out (typically I write the Gist and supply the tutorial but don't test the code unless the person comes back and says "I set up the tutorial but the code didn't work" because most of the time people don't run through the tutorial ;)

@Iain Dooley Honestly, i'm amazed that you went all that length to submit a code-example for my question, much appreciated. Plus you got me intrigued as it's always good to know there is the possibility of scripting, as it opens up infinite possibilities for automation.  I've updated the code, and this works. Thanks a lot! :) 

Like Iain Dooley likes this
Iain Dooley Community Leader Nov 09, 2019

@karlcassar I actually do it quite a bit! You can see tonnes of examples of Trellinator snippets here:

https://gist.github.com/iaindooley

I used to create business systems for clients using Butler Bot but I couldn't continue doing that as a consultant so I created Trellinator as a replacement. Later, they retired the bot and the power up was acquired by Trello, and there are many functions that the Bot used to have that are no longer (and apparently will never be) part of the power up so having a way to create custom extensions in a "butler-like" syntax using Google Apps Script is pretty powerful.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Trello

Develop a new Habit during Lockdown

If you had to thrive a new habit during a lockdown, what would it be? Trello

1,652 views 16 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you