Mistake with getting events from Trello to Google sheet

Hello everyone.

I made the workflow with getting events from Trello to Google sheets.
I need to registr the events with moving cards from one list to another list and with writing comments to one google list.

Ok, when I write comments in cards, the events are writing to Google sheet

But if I move cards from one list to another list, there is the mistake in workflow

And the procedure is broken and nothing oes to sheet

I understand that the procedure is different then comments to cards. But this is just registring events from Board. Can you help me?

Can anybody help me?

Hi @dmrudakov , Thanks for your patience. Since you shared the workflow with me via email earlier, I modified it to correct the error by updating the value of the final Google spreadsheet column to:

{{event.action?.display?.entities?.comment?.text}}

Notice the ?.That’s called the optional chaining operator. By default, JavaScript will throw an error if you try to reference a property of an undefined object. event.action.display.entities.comment doesn’t exist when you move cards, so when you try to read event.action.display.entities.comment.text, JavaScript throws an error.

When you use ?. to reference object properties, if any intermediate properties of those variables aren’t present, the variables would evaluate to undefined instead of throwing an error.

Let me know if that helps

Thank you very much Dylan! I tested this and it is super!

One more question about the timezone for date - are there any ways to get date time in russian timezone? image

Or this is one more topic in community?

Yes in this case, I’d recommend using a library like date-fns-timezone:

  1. Add a new step to your workflow above where you add data to Google Sheets, and select the option to Run Node.js code.
  2. Name your step convert_date
  3. Reference the docs of that library to convert the date (event.action.date) to your desired timezone, and return that data from the step. This will expose the new date at the variable steps.convert_date.return_value.
  4. In the Google Sheets step, replace {{event.action.date}} with {{steps.convert_date.return_value}}. This should add the date in your timezone to the sheet.

Dylan, can you look? I tried to do this, but I 'm newbe at js, not master. Sorry(((

Dylan sorry, can you help me? I wrote something by your rules, but nothing writes to sheet. My be I did something wrong?

Hi @dmrudakov , take a look at your workflow / Google Sheet now and let me know if that works.

By the way, we don’t traditionally help users write Node.js code. We have to focus on supporting the Pipedream platform itself. Luckily, Stack Overflow and a number of other sites are great places to ask questions about this kind of code.

FYI for anyone else who sees this, here’s the code:

const { formatToTimeZone } = require('date-fns-timezone');

const format = 'DD.MM.YYYY HH:mm:ss ZZ';
return formatToTimeZone(event.action.date, format, { timeZone: 'Europe/Moscow' });

Hello, Dylan. Thank you for help! Near time I’m going to learn node.js and I will not bother you, sorry…

I did not notice that you inserted this field at last column and tried to replace with that my existing field. Firstly it was recorded, but later it stopped to write… Strange…

I found my mistake and made return to actual version, and it restarted writing…))

One more question, about {{event.action.data.card.due}} and the description of cards.

card.due sometimes returns, sometimes not, but at the cards it exists.
{{event.model.desc}} returns standart messages from trello-command, but not the descriptions of cards:

"Hi there!

Feeling overwhelmed while running multiple projects??

As a Project Manager, I often use this useful template to help my internal and external teams to know where we are at any point for a particular site. We share this screen via Google Hangouts to make our meetings much more interactive and allows us to reprioritise quickly and easily.

I use the coloured Trello Labels in four ways to visually show progress against each task which really speeds up our meetings:

  • In progress - obvious really
  • With others to action - shows a task that is with an internal or external member to action
  • Blocked - Shows a task which is blocked from progressing
  • Completed - shows a task has been completed
  • No colour - Not allocated or assigned yet

I hope this is as useful to you as it has been for me. Thanks Trello!"

That’s a good question, and I’m not sure. I’d recommend reaching out to Trello support / the Trello community on that one.

Hello, Dylan. Thank you for help.

But what about {{event.action.data.card.due}} I asked above? How can I get card.due always?
card.due sometimes returns, sometimes not, but at the cards it exists.

We should be passing the data as it arrives from Trello. If you aren’t seeing the data arrive in the event, you should be able to make an API request to retrieve the card’s data with the card ID included in the request.

Again since this is a question specific to the Trello API, and not Pipedream, you’ll get the best answer by reaching out to Trello support / the Trello community.