2

I'm looking for a way to make an entry in the CommentLog with the SugarCRM API. I made the first attempts with PHP and the rest-php-client, but unfortunately found no way to write or read the CommentLog.

With Postman I can authenticate myself, use the token, read/create/update leads or accounts. Unfortunately, for example, I cannot make an entry in the CommentLog for a case.

My used endpoints are $url/rest/v10/CommentLog/$CaseId (POST) or $url/rest/v10/CommentLog (GET), booth without any success.

I see a addComment function on /rest/v10/help, but i dont know, how it works.

D_00
  • 1,440
  • 2
  • 13
  • 32
Nelson
  • 21
  • 1
  • If I'm not mistaken, the CommentLog acts like a relationship, so one way could be something like `POST $url/rest/v10/Cases/$CaseId/link/commentlog_link` to create a new CommentLog record that is linked to r specified Case. (Check /help for payload format). I'm not sure about the link name "commentlog_link" though; Maybe I can investigate or test it myself later. – Jay Oct 01 '21 at 23:34
  • I think commentlog_link is an endpoint. But I dont'n know, what the body should look like. `{ "description": { "comment": "Full text of the note" } }` it does not work. – Nelson Oct 05 '21 at 14:12

1 Answers1

1

Try something like this;

PUT rest/v10/Bugs/01114102-319a-11ec-b680-acde48001122 (<- replace the module and id here)

Body:

{
  "commentlog_link": {
    "create": [{"entry": "The comment goes here", 
    "_link": "commentlog_link", 
    "deleted": false}], 
    "add": [], 
    "delete": []
  }
}

Verified using Sugar version 11.0.2

ogge7
  • 314
  • 3
  • 5