Skip to content

Adding a file to a custom field when creating a deal #52

Description

@SparTT

I'm trying to add an image to a custom field when I create a deal, but I've been receiving the same HTTPError.

I'm trying to execute the code below:

const imgData = [{
  fileData: [ "test-st.png", "iVBORw0KGgoAAAANSUh..." ] // fileData[1] is a base64 str 
}]

let data = await bitrix.deals.create({
    fields: {
      TITLE: "ST-TEST",
      CATEGORY_ID: 18,
      UF_CRM_1659988440473: 4759,
      UF_CRM_1678981077892: imgData, 
    },
  }, {
    REGISTER_SONET_EVENT: 'Y'
})

The full error is:

{
    "name": "HTTPError",
    "timings": {
        "start": 1684867744230,
        "socket": 1684867744231,
        "lookup": 1684867744255,
        "connect": 1684867744410,
        "secureConnect": 1684867744568,
        "upload": 1684867744568,
        "response": 1684867744880,
        "end": 1684867744881,
        "phases": {
            "wait": 1,
            "dns": 24,
            "tcp": 155,
            "tls": 158,
            "request": 0,
            "firstByte": 312,
            "download": 1,
            "total": 651
        }
    }
}

What can I do to solve this?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions