Thanks. It worked. But still … the value in setter function is always null. Could you point me in a right direction with
Topic.update(topic, props);
How should custom_fields.bumped_at_with_button be passed to props in order to be saved?
I’ve tried something, but it doesn’t work
In following code only bumped_at get’s saved to database… and sadly no new record in topic_custom_fields table.
import Topic from 'discourse/models/topic';
export default {
actions: {
clickButton(topic) {
const current_date = new Date();
topic.set('bumped_at', current_date);
topic.set('custom_fields.bumped_at_with_button', current_date);
const props = topic.getProperties('bumped_at', 'custom_fields');
Topic.update(topic, props);
}
}
};