R31762 ObjectFiles - Set FileSizeBytes, MediaType, MediaWidth, MediaHeight

Code R31762
Entity Systems.Core.ObjectFiles Entity
Name SetFileSizeAndMediaProperties
Attribute FileSizeBytes, MediaType, MediaWidth, MediaHeight
Layer Back-End
Events Commit
Priority Normal
Modify YES
Applicable Legislations [ALL // no condition needed](https://confluence .erp.net/display/techdoc/Country+Specific+Functionality)
Action if (embeddedFileContents != null)
FileSizeBytes = embeddedFileContents.Size

if (embeddedFileContents.FileName != null)
MediaType = GetMediaType(embeddedFileContents.FileName) |

if (embeddedFileContents is image)
MediaWidth = (embeddedFileContents as Image).Width
MediaHeight = (embeddedFileContents as Image).Height
Description When an Object File is inserted, its File Size should be set to the EmbeddedFileContents.Length.
The MediaType is inferred by the file extension and the MediaWidth and MediaHeight is filled for image files.
Message
Version Introduced: 2022

Updated: -
Revocable No

* For more information about the Business Rules Documentation Template and a short explanation of each column, see topic System Business Rules.