How can I get the custom properties of a task when on click?

I have this piece of code to get the task on click but it doesn’t return any custom properties.

OnTaskClick() { gantt.attachEvent("onTaskClick", function (id, e) { var task = gantt.getTask(id); return true; });

This is how I add the task

this.tasks.data.push({ id: this.dataIdCounter, guidId: subProject.activities[c].activityId, type: activityType, text: activity.activityName, start_date: this.GetDateFormatted(activity.startDate), end_date: this.GetDateFormatted(activity.endDate), duration: activity.duration, progress: activity.pctComplete, open: true, parent: subProjectId });

guidId doesn’t show up, how can I access custom properties. I am using the trial version btw.

The only way I can get custom values to appear is to grab all the tasks

var tasks = gantt.getTaskByTime();

I don’t want to have to do that, is there another way?

Hello,

Can you provide with the demo?

Please clarify, have you this problem just with guidId?
And I’m not fully understand when you call OnTaskClick() function. Why doesn’t suit for you default call of event ‘onTaskClick’ ?
docs.dhtmlx.com/gantt/snippet/e3ec6f22

Thanks for your reply. I’m not sure why but it seems to be working now. Thanks for trying to help.