onUploaded

Runs after the Upload control has sent the binary to Attachment/Upload, optionally set the document type, and attempted to link the attachment to the current record. Use it to inform the user, refresh related controls, fire follow-up automation or reconcile errors.

When it runs

  • Exactly once per file, regardless of whether the automatic linking succeeded.

  • Triggers only for the new Upload control.

Event payload (eventArgs.details)

Field
Description

attachmentId

GUID returned by the Attachment API.

fileName / originalFileName

Final stored file name and the name chosen by the user.

fileSize / fileType

Metadata sourced from the browser.

documentTypeId / documentTypeLabel

Effective document type. null if none was set.

recordId / appName

Record context when the auto-linking step had the necessary IDs.

linked

true if the control linked the file to the record successfully; false when linking was skipped or failed (e.g., unsaved record, network issue).

Example

app.showMessage({
  title: "File Upload",
  content: `${eventArgs.details.fileName} was uploaded successfully.`,
  type: "success",
  sound: true,
  timeout: 2000,
  icon: "fa fa-bell swing animated",
});

Tips

  • Always branch on details.linked to avoid assuming the attachment already belongs to the record.

  • Combine with lightweight notification helpers to provide instant feedback without blocking the next uploads.

  • Use the attachmentId to call downstream APIs (OCR, archive, electronic invoice) as soon as the binary is available on the server.

Last updated

Was this helpful?