Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

Convert Butler command to Trellinator

I'm looking to convert some commands to Trellinator but am stuck with how to start coding :)

Basically I need to do a bunch of actions based on a change to a card. In this instance when a card is added to a specific list with some criteria set do the move and post a comment.

 

Is this something that Trellinator can do given the Butler command limit is low comparatively?

when a card without the green "Deposit Received" label is added to list "Accepted/ Waiting Deposit", set due in 3 working days, mark the due date as incomplete, move the card to the top of list "Accepted/ Waiting Deposit", and post comment "@reply Thank you for confirming that you would like to proceed with this job! "

1 answer

1 accepted

0 votes
Answer accepted
Iain Dooley Community Leader Sep 10, 2020

@Keith this function does what you want:

https://gist.github.com/iaindooley/f62327703716c8a25f7405b036e76d36

except I noticed that the markDueDateIncomplete method isn't present in the "quickstart" sheet you copied initially, so copy this function to line 847 of apps/trellinator-lib/Card.gs in the script editor:

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

I see that "@reply" comment -- are you using BenkoBoard or BenkoDesk? That's also my product :)

If you go to here:

http://docs.trellinator.com/

a good place to start is with the Notification class -- that's where most of your functions will begin if they're handling notifications. Scheduled commands are a bit trickier.

You can also see hundreds (maybe more than 1000) snippets and examples I've posted on the community here:

https://gist.github.com/iaindooley

hey @Iain Dooley 

 

thanks that works a treat. I've added in a whole bunch of functions already :)

 

I can't see any functionality on the docs in the notification class to return a card object once  a label has been added.


I.e. label is added, update card with xyz

Is this available or done another way?

(http://docs.trellinator.com/module-TrellinatorCore.Notification.html)

Iain Dooley Community Leader Sep 10, 2020

@Keith 

typically any notification that returns something other than a card will have a containing card set on it:

notif = new Notification(notification);

var card = notif.addedLabel("Whatevs").card();

var card = notif.completedChecklistItem().checklist().card();

var card = notif.attachedLink().card();

var card = notif.changedCustomFieldValue().card();

var board = notif.changedListName().board();

var board = notif.addedCard().board();

var board = notif.addedCard().list().board();

and so on. So each thing that gets returned will have a reference to it's container (checklist, card, list, board).

BTW what's with the "@reply" in your comment, are you using BenkoBoard/BenkoDesk??

Iain Dooley Community Leader Sep 10, 2020

@Keith oh i should also mention that those objects are available from the notification too:

notif.board();

notif.card();

notif.listBefore();//throws InvalidActionException if no list before

notif.listAfter();//throws InvalidActionException if no list after

You can use:

Notification.expectException(InvalidActionException,e);

Notification.expectException(InvalidDataException,e);

in your catch block so that if another exception is thrown (for example InvalidRequestException) that should cause processing to halt and be retried from the ExecutionQueue you don't catch and kill it.

For @reply I'm using Sendboard

 

I'll give the rest a go later on.

 

Thanks

Iain Dooley Community Leader Sep 10, 2020

@Keith ah okay, SendBoard ripped off my reply syntax then ;) I know they had plans to allow replies from comments.

hey @Iain Dooley 

 

Thanks again for your help!


Can you spot why I can't get this card to move?

function addedLabel_DepNotReq(notification)

{
var notif = new Notification(notification);
var card = notif.addedLabel().card();

try
{

card.label("Deposit not required");
card.postComment("hello");
card.moveTo("Ready to Program","top");
}

catch(e)
{
Notification.expectException(InvalidActionException,e);
Notification.expectException(InvalidDataException,e);
}
}

 

Clearly I'm missing something obvious in how the methods etc are structured and interacted with.

 

Thanks!

Iain Dooley Community Leader Sep 10, 2020

@Keith one note: expectException will throw an exception if it's not what was expected. You would typically only use one of them, in this case you would expect an InvalidDataException which is thrown if you try to access a label that doesn't exist on a card, but you could also check both like this:

Notification.expectException([InvalidDataException,InvalidActionException],e);

anyhoo, here's how I'd write that function:

https://gist.github.com/iaindooley/7573220968474ed842a9964d36e3ed34

Suggest an answer

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

📹 What is Trello?

Hello Community!  My name is Brittany Joiner and I am a Trello enthusiast and Atlassian Community Leader. I'll be sharing with you a series of videos with my top tips on how to best use Trello...

868 views 15 30
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