• JMap.Attachment.create

    Creates a new attachment for a data source item. The payload can represent either a file upload (file) or a URL attachment (url).

    Parameters

    Returns Promise<string>

    Example

    // Upload a file attachment
    JMap.Attachment
    .create("f47ac10b-58cc-4372-a567-0e02b2c3d479", {
    itemId: 7088,
    subject: "Site photo",
    description: "Photo taken during inspection",
    file: new File([blob], "inspection.jpg", { type: "image/jpeg" })
    })
    .then(id => console.log("Attachment created with id", id))
    .catch(error => console.error("Attachment creation failed", error))

    // Add a URL attachment
    JMap.Attachment
    .create("f47ac10b-58cc-4372-a567-0e02b2c3d479", {
    itemId: 7088,
    subject: "External link",
    url: "https://example.com/report"
    })
    .then(id => console.log("Attachment created with id", id))
    .catch(error => console.error("Attachment creation failed", error))