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

add value from one card's custom field to another card's different field

I'm trying to add the value from the custom field on one card to a different custom field on another card.

For example, I have a card with the POINTS custom field set to 5. When I move that card to the Done list, I'd like to add those card's POINTS to the TOTAL_POINTS field on another card.

I've fiddled around with Butler's find and lookup options, but can't see how to pass values between a custom field and a different field specified on either the trigger-card or the found-card.

Additionally, it would be nice if I could limit the field TOTAL_POINTS to one card only, without having to include it on every card on the board.

 

Many thanks--

1 answer

1 accepted

1 vote
Answer accepted
Iain Dooley Community Leader Oct 05, 2019

@RP yeah you can't do arithmetic with custom field values in the butler power up, here's a Trellinator function that does what you need:

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

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

Thanks for writing up that function. I'm sure it's great--if only I had any idea how to use it!

I followed the shorter startup guide in the link, and have it working, but have no idea how to do anything else, including implementing that little function or any other. Does this mean I have to learn to write javascript?

There is one way to perform arithmetic on custom fields in Trello. The problem is that it requires dedicating your card's description fields to storing the value of the custom field you want to sum.

So eg this Butler rule will store Points in the description field:

when custom field "Points" is set by anyone, set the card's description to "{{%Points}}"

Then this rule will transfer that card's Points to another card (WEEK SCORE card), add them to existing Points in that card's description, and copy the total to the custom field SCORE.

when a card is moved into list "Done" by anyone, find a card titled "WEEK SCORE" in list "Done" on board "JNP ToDo", set the card's description to "{triggercarddescription} + {foundcarddescription}", and set custom field "SCORE" to "{foundcarddescription} + {triggercarddescription}"

But it's pretty kludgy.

RP

Iain Dooley Community Leader Oct 11, 2019

@RP if you were able to get the initial function working from the article, then all you need to do is follow the exact same procedure as you did for installing the code under the heading "Something more interesting". If you set that thing up as a global command then invite your Trellinator bot user to will run the function for any card moved to a list called "Done" with a card called "Points Overview" in it.

EDIT: resolved this; I guess I hadn't updated the script editor after changing/correcting  that function

 

Ok thanks--I've been messing around with it a bit more and can now do what you're describing. It's great.

a couple questions:

  1. for some of the functions being run in the Google sheet, I'm regularly getting error messages like this in the info log: "executing realtime function: subtasksNewName","Test Board [5d99ea0bc4081f7cd7ee66cf]subtasksNewName\n98eb8c1a65c299e057b5259b39761243","function: subtasksNewName TypeError: Cannot find function subtasksNewName in object [object Object]."
    1. this is for your function subtasks that I renamed subtasksNewName
    2. part of what's weird is that the function will eventually run as expected
  2. perhaps relatedly--often the lag between inputting the trigger on the Trello board and having the function run is 10 minutes or more. Is that normal?
  3. I'm doing all this on the Test Board set up per the intro to trellinator article.

Many thanks for your help.

Iain Dooley Community Leader Oct 12, 2019

@RP yeah the reason it failed and then worked is because you hadn't published the web app again. So when the notification came in it was executing from the previously published web app code, failing and being written to the execution queue, and then executed within 10 minutes as a retry but when it executes from the queue it runs as a project trigger from the current code regardless of whether or not it's been published as a web app.

Thanks for the explanation.

Two more questions--I hope the last!

  1. I'm now getting a similar error with a function you nicely provided on the public Trellinator board (I was also asking questions there; not sure which is considered more appropriate). It's for this function: Edited subtasks.
    1. Here's the error: "Error executing function: TypeError: "function: convertSubtasks TypeError: Cannot find function convertedChecklistItemToCard in object [object Object]."
    2. The info log shows the trigger: ["Examining Notification: [5da1b45d44be9a42324fda50-convertToCardFromCheckItem]"

    3. In this case, I did save the web app file before the error appeared. It seems to be sticking on the convertedChecklistItemToCard term.
  2. Though a programming noob, I'm motivated to dig into the documentation and see what I can piece together in trellinator. What would you suggest as the place to start learning how to write some of those function snippets? I can sort of follow what's happening in the prewritten code, but wouldn't know where to start in attempting my own. Is javascript the basis? Any suggestions on where to go to get a minimally useful foundation in javascript? And are all the Trellinator classes/terms/syntax available online?

Really appreciate your generous attention and the inspiring potential of Trellinator. It's great to imagine being able to get the thing to do just what I want.

Iain Dooley Community Leader Oct 12, 2019

@rpfs hey for some reason I got an email notification with another question but it doesn't appear above. Anyway I'll respond here:

I'm now getting a similar error with a function you nicely provided on the public Trellinator board (I was also asking questions there; not sure which is considered more appropriate)

I think it's best to ask those types of questions here, that way we get a bit of a buzz going around Trellinator :)

Here's the error: "Error executing function: TypeError: "function: convertSubtasks TypeError: Cannot find function convertedChecklistItemToCard in object [object Object]."

The issue here is that whilst I created the new Notification function and pushed it to the github repo, it's not in your code yet.

There are 2 ways to update, one is easier but more error prone, the other is a bit more complicated but probably a good idea to get your head around if you're interested in doing this for any appreciable amount of time.

Method #1: replace the entire contents of Notification.gs with this and then publish again as a web app:

https://github.com/iaindooley/trellinator-libs/blob/master/Notification.js

In this case, it's probably pretty easy to do that, and not likely to break things because there was only a change in one file.

Method #2: Run through steps 1 - 20 of this in-aptly named Hello World tutorial which shows you how to connect a command line git repo to a sheet and publish/deploy with clasp:

https://www.theprocedurepeople.com/trellinator-automate-trello/docs/trellinator_hello_world.pdf

Once you've got that sorted, applying future updates is as simple as running:

trellinator upd
trellinator push

this ensures you always get the latest code, and also makes it much easier to update when the changes span multiple files.

https://www.codecademy.com/learn/introduction-to-javascript

Though a programming noob, I'm motivated to dig into the documentation and see what I can piece together in trellinator. What would you suggest as the place to start learning how to write some of those function snippets? I can sort of follow what's happening in the prewritten code, but wouldn't know where to start in attempting my own. Is javascript the basis? Any suggestions on where to go to get a minimally useful foundation in javascript?

Yep Google Apps Script is just javascript under the hood, although there are different versions and technically it's ECMA Script so not everything you see online about, for example, how to write Node, will work in Google Apps Script. But yes basically if you learn JavaScript you'll know how to write Google Apps Script and since the majority of what you want to learn is to write Trellinator code you won't have to worry too much about any of the details of how the JS implementation in GAS differs from other implementations.

Codecademy is probably a good place to start:

https://www.codecademy.com/learn/introduction-to-javascript

 And are all the Trellinator classes/terms/syntax available online?

Yep it's fully documented. All the code is on github:

https://github.com/iaindooley/trellinator-libs

and there's documentation for everything here:

https://www.theprocedurepeople.com/trellinator-automate-trello/docs/

The tutorial that I called "Hello World" but which turned into a 57 step behemoth is the most canonical way to setup and develop Trellinator because it comes with the ability to write and run command line tests, do proper version control and deploy your code but it's not really a course in what you'd call "Idoimatic Trellinator Patterns".

That's actually a course I've been thinking about creating. Maybe you could help me create it :) If you get a basic grounding in JavaScript then email team@benkoboard.com with your questions out of the gate I can get a feel for how I should structure the course and what to include at what stage.

The first step would be the anatomy of a Trellinator command, installing a Trellinator command globally, in a global command group or for an individual board, how exception handling works, then the execution queue and time triggered functions.

Like Daniel Santos likes this
Iain Dooley Community Leader Oct 12, 2019

@RP see above! 

Hi @Iain Dooley

The message missing from @RP went to the spam queue somehow. I moved it back to the thread and now you should see it. I'm glad you could answer it anyway.

=]

@Iain DooleyAwesome rundown, thanks. I will dig into that longer Hello World tutorial.

Incidentally, I can tell you now that your last post is by far the best information I can find on how to get into Trellinator for people with my level of (in)experience. Especially re the difference between the short and long tutorials.

cheers--

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,506 views 12 5
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