Disable upload button when max count is reached#493
Merged
Conversation
rashmiangadi05
previously approved these changes
May 28, 2026
PujaDeshmukh17
previously approved these changes
May 28, 2026
27546f9
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe your changes
Added populateUploadableFlags — an @after READ handler in SDMReadAttachmentsHandler that computes and injects virtual uploadable flag fields (e.g. isAttachmentsUploadable) into read results at runtime. Fiori Elements reads these flags via InsertRestrictions.Insertable to enable/disable the Upload button when a facet reaches its @SDM.Attachments.maxCount limit.
Consumer setup (CDS annotations only, no Java changes)
// 1. Virtual field on parent entity
entity Books { virtual isAttachmentsUploadable : Boolean; }
// 2. Wire InsertRestrictions + SideEffects on the parent
annotate AdminService.Books.attachments with @(
Capabilities: { InsertRestrictions: { Insertable: up_.isAttachmentsUploadable } }
);
annotate AdminService.Books with @(
Common.SideEffects #sdmAttachmentsUploadable: {
SourceEntities: ['attachments'],
TargetEntities: [''] // re-reads the parent entity after upload/delete
}
);
Any documentation
Type of change
Please delete options that are not relevant.
Checklist before requesting a review
Upload Screenshots/lists of the scenarios tested
Single-tenant Integration tests: https://github.com/cap-java/sdm/actions/runs/26389837903
Multi-tenant Integration tests: https://github.com/cap-java/sdm/actions/runs/26442233609
Created 4 attachments in attachments facet one by one, once the 4th attachment got uploaded Upload button got disabled. Then deleted one of the attachment, Upload button was re-enabled and then uploaded one more attachment. After successfull upload, the Upload button got disabled.