Hi, I am trying to pass a new Notion page to google sheets.
The challenge I have is with my “Tags” field, which can contain no tags, one tag, or multiple tags.
Each of which are pulled into Pipedream as separate items.
(see screenshot)
I am trying to create a code step to convert the individual items to a string, but I’m not sure how to access the previous step correctly.
I was given this code by the Pipedream bot, and it does return a string as desired, but I need to pass it the actual values from the previous step (as in the screenshoot)
thank you
export default defineComponent({
async run({ steps, $ }) {
const properties = {
"4": {
"Contributor": {
"4": {
"Tags": {
"3": {
"id": "MR~A",
"type": "multi_select",
"multi_select": [
{
"id": "516eda61-dd64-40b8-92e1-8c61533917f5",
"name": "Tag 8",
"color": "yellow",
},
{
"id": "E{:f",
"name": "Tag 1",
"color": "default",
},
],
},
},
},
},
},
};
const tags = properties["4"]["Contributor"]["4"]["Tags"]["3"]["multi_select"];
const tagNames = tags.map((tag) => tag.name);
const tagString = tagNames.join(", ");
return tagString;
},
});