So I’ve recently been working on creating some sample code using the kintone REST API Request , Add Thread Comment API and the Record Create Event.
What I wanted to do, was to post comments into a space thread every time a new record is added into an app.
I tried to do this with the below code, but can’t seem to debug the error that comes up. The error comes up for a tiny bit in the console, but since the event is run when I’m adding records, the error only stays in the console for a split second before the page changes, and the consol refreshes.
I can’t seem to find what’s wrong though
(function() {
“use strict”;
kintone.events.on(“app.record.create.submit”, function(e) {
var user = kintone.getLoginUser().name;
var commentbody = {
“space”: 11,
“thread”: 17,
“comment”: {
“text”: user + " posted the following: “” + e.record.titletext.value +"""
}
}
kintone.api(’/k/v1/space/thread/comment.json’, ‘POST’, commentbody);
});
})();