Documentation

Comments

Scope: catalog Permissions: all

Set of methods for handling comments in items timeline.

In actuality, comments are the same timeline records, but displayed differently and with option to be edited by user.

Comment data can be retrieved using the method rpa.timeline.listForItem. This method returns all records, including comments.

rpa.comment.*

Method Description Available from version
rpa.comment.add({typeId: number, itemId: number, fields: {}}) Creates new comment in item's timeline with identifier itemId of process with ID typeId. Parameters:
  • typeId - process identifier
  • itemId - item identifier
  • fields - comment fields.
    • description - record description (use html and BB-code)
    • files - array of attached files, where each item is an array with name and base64-encoded content

Query example

{
    "typeId": 24,
    "itemId": 10,
    "fields": {
        "description": "reference of user with ID 1 [USER=1]John[/USER]",
        "files": [
            [
                "document.pdf", "...base64_decoded_content..."
            ]
        ]     
    }
}

Result

{
    "comment": {
        "id": 350,
        "createdTime": "2020-03-27T16:00:59+02:00",
        "isFixed": false,
        "typeId": 24,
        "itemId": 10,
        "action": "comment",
        "description": " Reference of user with ID 1 [USER=1]John[/USER]",
        "userId": 1,
        "title": "Comment",
        "data": {
            "files": [
                15
            ]
        },
        "createdTimestamp": 1585317659000,
        "htmlDescription": "Reference of user with ID 1 <a class=\"blog-p-user-name\" id=\"bp_K6r6vvp7\" href=\"/company/personal/user/1/\" bx-tooltip-user-id=\"1\">John Smith</a> &nbsp;",
        "textDescription": "Reference of user with ID 1 John",
        "users": {
            "1": {
                "id": "1",
                "name": "John",
                "secondName": "",
                "lastName": "",
                "title": null,
                "workPosition": "",
                "fullName": "John",
                "link": "/company/personal/user/1/"
            }
        }
    }
}
rpa.comment.update({id: number, fields: {}}) Method updates timeline record with identifier id. Parameters:
  • id - comment identifier
  • fields - record fields.
    • description - record description (use html and BB-code)
    • files - array of attached files, where each item is an array with name and base64-encoded content

This method allows modifying fields title and description

This method allows modifying only those comments that were added by the same user.

To update new file, pass a list as a record in the old file, with the key id will contain ID of the file attached to this comment.

To upload new files, pass an array with name and base64-encoded content

Example

{
    "typeId": 24,
    "itemId": 10,
    "fields": {
        "description": "Reference of user with ID 1 [USER=1]John[/USER]",
        "files": [
            {
                "id": 15   
            },
            [
                "another_document.pdf", "...base64_decoded_content..."
            ]
        ]     
    }
}
rpa.comment.delete({id: number}) Method deletes comment with identifier id. Parameters:
  • id - record identifier

This method allows deleting only those comment that were added by the same user

© «Bitrix24», 2001-2024
Up