You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.
View groupJoin the community to find out what other Atlassian users are discussing, debating and creating.
Hi, I am new to trellinator framework. I am trying to add a functionaity to my board.
I want a user different than trellinator to post a comment. This comment will be a number that we can call "x".
This comment will trigger a function that will copy the first "x" cards from list "A" to list "B".
So the use case will be...
1. User A post a comment with number "2".
2. The first "2" cards from list "A" will be copy to list "B"
Here I have some code I have been able to build.
function copyOnComment(notification)
{
var notif = new Notification(notification);
var A = new Trellinator().board("Board A").findOrCreateList("A");
var B = new Trellinator().board("Board B").findOrCreateList("B");
var x = 0;
if(notif.member().notTrellinator())
{
notif.board().list("A").cards().each(function(card)
{
x = x+1;
card.copyToList(B,1);
if(x>1)
exit();
});
}
}
Right now the copyToList function is not working. If I change the copyToList for a "post comment" it will stay on a loop and post comments on first two card list infinitely.
Any ideas on how to make this work?
@Carlos Pozos Ochoa great to see you're getting some use out of Trellinator :)
Looks like exit(); doesn't exist in Google Apps Script, maybe upgrade your project to the V8 runtime? I haven't tested Trellinator extensively using the V8 runtime but I do have a couple of projects running on it and it seems to Just Work(TM) for the most part.
Here is your code rewritten without the use of exit():
https://gist.github.com/iaindooley/82e600603fa363ab41257f55818e47c4
Also note that when this failed, the reason it was "looping" was because when an exception is thrown that isn't an InvalidDataException or an InvalidActionException it will store the notification in the ExecutionQueue tab and retry it every 10 minutes (this is because sometimes it's an API error, and it's better for something to happen twice than not at all).
When debugging this, you can copy the JSON from the ExecutionQueue and do this:
var obj = {JSON GOES HERE};
functionName(obj.parameters);
If you execute that directly from the script editor then you can see more clearly what exception gets thrown. You can also see the exceptions logged in InfoLog but sometimes that moves pretty fast so I find the above an easier way to drill down into what's causing the problem.
Happy automating!
Thank you very much for the info, very useful. Help me a lot to implement this functionality.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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...
Connect with like-minded Atlassian users at free events near you!
Find an eventConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.
Host an eventYou're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.