Convert Butler command to Trellinator

Keith September 9, 2020

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
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 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

Keith September 10, 2020

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
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 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
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 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.

Keith September 10, 2020

For @reply I'm using Sendboard

 

I'll give the rest a go later on.

 

Thanks

Iain Dooley
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 10, 2020

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

Keith September 10, 2020

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
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 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
AUG Leaders

Atlassian Community Events