Skip to content

record download-file: Image column download fails with 'No FileAttachment records found' #86

Description

@TomProkop

Description

txc env data record upload-file reports success when uploading to an image column, but download-file then fails with a FileAttachment lookup error. The round-trip (upload → download) is broken for image columns, while file columns work correctly.

Steps to Reproduce

# 1. Upload a PNG to an image column — reports success:
txc env data record upload-file \
  --entity txcv3_valv3rt1434 \
  --record-id 11ad3537-704c-f111-bec7-6045bde02116 \
  --column txcv3_imagefield \
  --file ./test-image.png \
  --allow-production
# Output: Uploaded 'test-image.png' to txcv3_valv3rt1434/.../txcv3_imagefield

# 2. Download the same image — fails:
txc env data record download-file \
  --entity txcv3_valv3rt1434 \
  --record-id 11ad3537-704c-f111-bec7-6045bde02116 \
  --column txcv3_imagefield \
  --output ./downloaded-image.png \
  --allow-production

Expected Behavior

Download should retrieve the uploaded image and save it to the output path.

Actual Behavior

No FileAttachment records found for imagedescriptorId: 13f5eddc-714c-f111-bec6-7c1e52766187
for image attribute: txcv3_imagefield of txcv3_valv3rt1434 record with id 11ad3537-...

Analysis

Querying the record shows txcv3_imagefield: "System.Byte[]" — the image data was stored in the legacy binary format. The download command looks for a FileAttachment record (which is the modern storage mechanism for CanStoreFullImage=true columns), but finds none.

Possible causes:

  1. Upload stored the image in the old binary format instead of as a FileAttachment
  2. Download uses FileAttachment lookup but should also handle the legacy binary format
  3. Image columns may require a different API path (/entityimage vs /) than file columns

Comparison: File column works correctly

# File upload + download round-trip works perfectly:
txc env data record upload-file --column txcv3_filefield ...   # ✅ Succeeds
txc env data record download-file --column txcv3_filefield ... # ✅ Succeeds, content matches

Impact

🟡 Medium — File columns work correctly. Only image columns are affected.


Found during PR #67 (pp-entity-attribute) CRUD validation on https://udpp26-txc-demo.crm4.dynamics.com.

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