Image Capture and Signature Handling
COSMO Mobile Solution supports handling images and signatures using the mobile application and the Business Central web client. Images can be stored in the database using MediaSet
, Media
, or Blob
data types, or in external storage systems such as an FTP server. A key advantage of this solution is the use of MediaSet
fields in document or document line tables (e.g., Warehouse Shipment or Warehouse Receipt).
Use MediaSet in Page Customizations for the Mobile Application
To access the image gallery in the mobile application, a MediaSet
field must exist in the SourceTable
of the published and configured web service page. This field does not need to be added to the page, as its presence in the table is sufficient. For configuration details, see Image Configuration.
MediaSet-Based Gallery Development in Card Pages in the Web Client
COSMO Mobile Solution enables the visualization of MediaSet
-based image galleries in Card pages within the Business Central web client, requiring minimal development.
- Prerequisities
- A
MediaSet
field in the source table of the document (e.g.,Item.Picture
). - A Card page or a page extension for a Card page where the gallery will be displayed (e.g., page extension for
"Item Card"
).
- A
- Solution
Add a
Part
to thefactboxes
section of the Card page or its extension. Set the part type to"CCS MS MediaSet Gallery"
. This part includes all necessary functionality, so no modifications are required:addbefore(ItemPicture) { part("MyOwnItemPictureGallery"; "CCS MS MediaSet Gallery") { ApplicationArea = All; } }
Refresh the gallery in the
OnAfterGetCurrRecord
trigger of the Card page:trigger OnAfterGetCurrRecord() begin CurrPage.MyOwnItemPictureGallery.Page.ChangeMediaSetSource(Rec, Rec.FieldName(Picture), false); end;
After publishing the extension, the gallery will appear among the FactBoxes.
Alternative Image Sources for the Web Client (Media, Blob, File System, FTP, etc.)
For non-MediaSet
image galleries, the backend implementation must be fully developed in Business Central to achieve similar functionality.
Alternative Image Sources for the Mobile Application (Media, Blob, File System, FTP, etc.)
When using storage types other than MediaSet
(e.g., Blob, file system, FTP), enable the Show Images on Card toggle and disable all other image-related settings.
In such cases, a custom extension for COSMO Mobile Solution must be developed to handle image reading and writing. Helper codeunits and subscription points are provided in the solution's source code.
Event Handlers for Image Handling
To enable gallery management in the mobile application, implement the following event handlers:
"CCS MS Image Handler Intf.".OnGetImageIds()
: Retrieves image identifiers (e.g., file names) for a specific record.- Parameters:
ServiceName
: The Web Service name of the page customization where the image gallery functionality should be enabled (e.g., CCSMSWhseShipmentHeaderWS, if you want to handle images on the shipment document).RecId
: The RecordId of the record to get the image identifiers for.ImageIds
: The list of image identifiers to be returned.
- Parameters:
"CCS MS Image Handler Intf.".OnGetImages()
: Retrieves images or thumbnails for a specific record. It will be called when the mobile application needs to display the images.- Parameters:
ServiceName
: The Web Service name of the published page to identify which page is used as the caller page.RecId
: The RecordId of the record to get the images for._ImageIds
: The list of image identifiers to be returned. If this list is empty, all of the images related to the record have to be returned.ImageContainer
: The container to return the images in. This is a helper codeunit where all the necessary functionalities are implemented. It stores and handles images temporarily during the image handling process.Thumbnail
: This switch describes whether the images should be returned in thumbnail or in original size.
- Parameters:
"CCS MS Image Handler Intf.".OnGetFavotiteImage()
: Retrieves the favorite image for a specific record. It will be called when the client application needs to display the favorite image on the list view.- Parameters:
ServiceName
: The Web Service name of the published page to identify which page is used as the caller page.RecId
: The RecordId of the record to get the favorite image for.ImageContainer
: The container to return the favorite image in. This is a helper codeunit where all the necessary functionalities are implemented. It stores and handles the images temporarily during the image handling process.Thumbnail
: This switch describes whether the images should be returned in thumbnail or in original size.
- Parameters:
"CCS MS Image Handler Intf.".OnSetFavoriteImage()
: Sets the favorite image for a specific record. It will be called when the user changes the favorite image in the mobile application.- Parameters:
ServiceName
: The Web Service name of the published page to identify which page is used as the caller page.RecId
: The RecordId of the record to set the favorite image for.ImageId
: The identifier of the image to set as favorite.
- Parameters:
"CCS MS Image Handler Intf.".OnDeleteImages()
: Removes the specified images from a specific record. It will be called when the user deletes the images in the mobile application.- Parameters:
ServiceName
: The Web Service name of the published page to identify which page is used as the caller page.RecId
: The RecordId of the record to remove the images from.ImageIds
: The list of image identifiers to be removed.
- Parameters:
"CCS MS Image Handler Intf.".OnAppendImage()
: Appends a new image to a specific record. It will be called when the user adds a new image to the gallery in the mobile application.- Parameters:
ServiceName
: The Web Service name of the published page to identify which page is used as the caller page.RecId
: The RecordId of the record to append the image to.ImageToAppend
: A container that contains the new image received from the mobile application to append for the record. This is a helper codeunit where all the necessary functionalities are implemented. It stores and handles the images temporarily during the image handling.ThumbnailToSendBack
: The container to return the thumbnail of the appended image in. If the image identifier is different than the original one, the new identifier will be used in the mobile application. If the thumbnail is not returned, the client application will use the original image with the original identifier. This is a helper codeunit where all the necessary functionalities are implemented. It stores and handles the images temporarily during the image handling.
- Parameters:
Wichtig
Implement all event handlers above to enable full gallery functionality in the mobile application.
Use Signatures in the Mobile Application
Signatures are not supported in standard Business Central but can be integrated with COSMO Mobile Solution using custom implementations.
- Prerequisities
- A storage solution where the signatures can be saved to and read from. For example, a Blob field in the document table.
- A dummy field (e.g., a page field where the source expression is an
Integer
orBoolean
constant) on the page customization of the document page configured as Signature (see Field Type in the CardView FastTab).
Event Handlers for Signature Handling
If this is done, and the Field Type of the dummy field is set to Signature on the page customization, the following three event handlers have to be implemented in COSMO Mobile Solution:
"CCS MS Image Handler Intf.".OnGetSignature()
: Retrieves a signature for a specific record. It will be called when the mobile application needs to display the signature.- Parameters:
ServiceName
: The Web Service name of the published page to identify which page is used as the caller page.RecId
: The RecordId of the record to get the signature for.FieldName
: The name of the dummy field that represents the signature. It is needed to identify which signature has to be handled if more than one signature is defined for a page.ImageContainer
: The container to return the signature to. This is a helper codeunit where all the necessary functionalities are implemented. It stores and handles the images temporarily during the image handling.
- Parameters:
"CCS MS Image Handler Intf.".OnDeleteSignature()
: Removes the signature from a specific record. It will be called when the user deletes the signature in the mobile application.- Parameters:
ServiceName
: The Web Service name of the published page to identify which page is used as the caller page.RecId
: The RecordId of the record to remove the signature from.FieldName
: The name of the dummy field that represents the signature. It is needed to identify which signature has to be handled if more than one signature is defined for a page.
- Parameters:
"CCS MS Image Handler Intf.".OnSetSignature()
: Sets the signature for a specific record. It will be called when the user signs a document in the mobile application.- Parameters:
ServiceName
: The Web Service name of the published page to identify which page is used as the caller page.RecId
: The RecordId of the record to set the signature for.FieldName
: The name of the dummy field that represents the signature. It is needed to identify which signature has to be handled if more than one signature is defined for a page.ImageContainer
: The container that contains the signature to set for the record. This is a helper codeunit where all the necessary functionalities are implemented. It stores and handles the images temporarily during the image handling process.
- Parameters:
Wichtig
Implement all event handlers above to enable full signature functionality in the mobile application.
Feedback
Submit feedback for this page .