helo,
I have tried to customize this to my data:
But I failed. Could you help me out, please? It does not create calender events if there are no new events. But it creates all the events if there is a new event, not just the new one. Strange.
Example polling code
const new_items = [];
// Get static data stored with the workflow
const data = this.getWorkflowStaticData("node");
data.ids = data.ids || [];
for (let i = items.length - 1; i >= 0; i--) {
// Check if data is already present
if (data.ids.includes(items[i].json.ID)) {
break;
} else {
// if new data then add it to an array
new_items.push({
json: {
id: items[i].json.ID,
name: items[i].json.Name,
email: items[i].json.Email
},
});
}
}
data.ids = items.map((item) => item.json.ID);
// return new items
return new_items;
For this structured data
[
{
"id": 0,
"name": "Sam",
"email": "[email protected]"
},
{
"id": 1,
"name": "Ram",
"email": "[email protected]"
}
]
How to rewrite the polling code for this structure?
{
"name": "0f9545e151",
"date": "2022-07-06",
"description": "Sync To Do to Googel Calendar with n8n",
},
Thank you for your help
ps: I am on self hosted 0.181.1 version