Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

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

RP October 5, 2019

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 Champion
October 5, 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

RP October 9, 2019

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 Champion
October 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.

RP October 11, 2019

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 Champion
October 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.

RP October 12, 2019

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 Champion
October 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 Champion
October 12, 2019

@RP see above! 

Daniel Santos
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 14, 2019

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.

=]

RP October 14, 2019

@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--

Feier Florin December 30, 2021

I just installed Trellinator and it is awsome (I haven't coded since highschool, I'm a pharmacist by training :p so this help request might have an obvious answer that I'm missing)

I am trying to do a smilar thing to add custom field values on different cards.

I am actually trying to keep track of employees days off and I need to add the custom field value from recived leave requests in list ("Received") to the coresponding card in the total days off list ("Total Days Off"), but the catch is that I need to update the member's card in "Total Days Off" list.

The member is joined both in the received card on the "Received" list and in his personal card in the "Total Days Off" list.

Any sugestions would be wellcomed.

Allso, can I get data from card description and input it to the speciffic custom field on a card?

I am using jotform to submit leave requests, and the information arrives in the description section of the Trello card (because the integration between Jotform and Trello is quite simplistic)

so in the description the message looks something like " start date: DATE; end date; DATE; number of days off: NUMBER OF DAYS" 

My goal is to get the NUMBER OF DAYS in the description and put it in the corresponding custom field "Number of days off" on the newly created card.

 

Thank you in advance, and have a happy new year! :)

Feier Florin January 13, 2022

Trellinator is really amazing. I have never worked with java script yet I manage to accomplish my goals.

The sky is the limit.

@Iain Dooley  great job!

Iain Dooley
Community Champion
February 3, 2022

@Feier Florin congratulations on getting it up and running and on achieving your development goals! There have been several changes to the way that deployment works in Google Sheets including one which actually can't be worked around without reverting back to the legacy editor (these are the bug reports linked from the quickstart template ... ) so I see more failed attempts on the queue these days.

Like motz182 likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events