Start a conversation

ACRM/CRM.web: Show Custom Fields in a One-Off Document Upload Dialog Using a Custom <code>expandName</code>

Overview

In ACRM/CRM.web, a one-off custom document upload action may still open with the default upload dialog configuration (for example, logs show expandName:"D1.Upload") even when a custom expand/field group exists. This typically happens when expandName is passed to an API that does not support it (u8.services.documents.createDocument(...)) or when expandName is passed at the wrong object level in u8.services.documents.upload(...).

The recommended approach is to use the upload popup flow (u8.services.documents.upload(...)) with a correctly structured options payload: provide a top-level infoAreaId (or uid/documentKey) to satisfy validation, and place expandNameupload:{...} so the DocumentUpload widget applies the custom expand.

Solution

Scenario

You need a one-off custom document upload dialog in ACRM/CRM.web that shows additional fields (for example, two catalog fields) without changing the global/default upload dialog (for example, without modifying D1.Upload or global settings such as D1.Upload.details).

Symptoms / How to Recognize It

  • The upload dialog opens, but the additional fields from your custom configuration do not appear.
  • CRM.web console/network shows the default expand being used, for example expandName:"D1.Upload" in the ExpandChannel.Get payload.
  • If the documents.upload(...) call is structured incorrectly, you may see this exact exception:
    • Exception: Error:In order to upload a document you must specify a uid, a documentKey or an info area id!; uid=u8.Base/Error/99

Root Cause

  1. u8.services.documents.createDocument(...) cannot switch the upload dialog via expandName.

    Passing expandName to createDocument does not change which upload fields are shown, so the UI continues to use the default upload configuration.

  2. u8.services.documents.upload(...) has two simultaneous requirements.

    • Top-level validation requirement: the object passed to documents.upload(...) must include one of:

      • uid, or
      • documentKey, or
      • infoAreaId
    • Upload widget configuration requirement: the upload popup applies UI options (including expandName) from a nested object:

      • upload: { ... expandName ... }
  3. If expandName is not inside upload:{...}, the upload UI falls back to the default (commonly D1.Upload). If everything is placed only under upload:{...} and the top-level options omit uid/documentKey/infoAreaId, the call fails immediately with the validation exception shown above.

Resolution (One-Off Upload Button/Action)

1) Prepare the CRM.Designer Configuration

  • Create (or confirm) a D1 expand configuration and underlying field group that contains the extra catalog fields you need.
  • Use the base expand name for runtime references (do not reference the .details suffix as the runtime name).
  • Example naming pattern: D1.<custom_upload_expand_name>

2) Use u8.services.documents.upload(...) with Correct Nesting

Provide a top-level infoAreaId (to satisfy validation) and keep expandName under upload:{...} (so the upload widget applies it):

myNamespace.customDocumentUpload = function (args) {
  u8.services.documents.upload({
    infoAreaId: "D1",
    upload: {
      linkUid: { infoAreaId: "<linked_info_area_id>", recordId: args.uid.recordId },
      allowMultiple: false,
      expandName: "D1.<custom_upload_expand_name>"
    }
  }, function (sender, result) {
    // result.uid = uploaded document uid
  });
};

Notes:

  • Keep values quoted as strings (unless you intentionally pass variables).
  • linkUid should point to the record you want the uploaded document to be linked to (replace <linked_info_area_id> appropriately).

3) Invalidate CRM.web Cache After Configuration Changes

After adding or changing upload-related configuration in CRM.Designer, invalidate the CRM.web cache so clients load the updated configuration. UI configuration changes commonly require cache invalidation before they take effect.

Verification

  1. Click the one-off upload button/action.
  2. Check CRM.web network/console for the ExpandChannel.Get payload.
  3. Confirm it now uses your custom expand name:
    • Expected: expandName:"D1.<custom_upload_expand_name>"
    • Not expected: expandName:"D1.Upload"
  4. Confirm the upload dialog displays the additional catalog fields and that the document upload completes successfully.

Frequently Asked Questions

1. How do I know this is the same issue?

This matches if you either (a) see the upload dialog still using the default expand in logs (for example expandName:"D1.Upload"), or (b) you hit the exact exception:

Exception: Error:In order to upload a document you must specify a uid, a documentKey or an info area id!; uid=u8.Base/Error/99

2. Why doesn’t expandName work with u8.services.documents.createDocument(...)?

The upload dialog configuration is not switched by passing expandName into createDocument(...). For a custom upload UI (extra fields/catalogs), use the upload popup flow (u8.services.documents.upload(...)) and pass expandName in the structure consumed by the upload widget.

3. I nested everything under upload:{...} and now I get: “In order to upload a document you must specify a uid, a documentKey or an info area id!”

Add a top-level infoAreaId:"D1" (or provide a top-level uid/documentKey). The upload service validates the top-level object before the popup opens, even though UI options like expandName must remain under upload:{...}.

4. How can I verify the custom expand is actually being applied?

Inspect the ExpandChannel.Get request payload and look for expandName. If it shows the default (for example D1.Upload), the custom value is not reaching the upload widget. When correctly applied, expandName should match your custom value (for example D1.<custom_upload_expand_name>).

5. Do I need to change Document.UploadFieldGroup.D1 for this one-off use case?

No. Document.UploadFieldGroup.D1 controls the global/default upload dialog. For a single special action, keep the global default unchanged and pass your custom expandName only in the one-off documents.upload(...) call.

6. I updated the Expand/Field Group in CRM.Designer but nothing changes in CRM.web. What should I do?

Invalidate the CRM.web cache after configuration changes, then reload the client. Configuration updates commonly require cache invalidation before they appear in the UI.

Choose files or drag and drop files
Was this article helpful?
Yes
No
  1. Priyanka Bhotika

  2. Posted

Comments