Consumer
Goods Cloud Mobile App Framework supports the direct download of mandatory
attachments on a mobile device. The mandatory attachments are downloaded automatically during
Initial Sync or First Sync of the Day.
Required Editions
Available in: Lightning Experience in Professional, Unlimited, and
Enterprise Editions that have Consumer Goods Cloud enabled.
A method, BoSfReplicationCallback.requestMandatoryAttachmentDataAsync, is called by the app
to retrieve a list of the requested attachments. The
BoSfReplicationCallback.requestMandatoryAttachmentDataAsync method uses a helper method,
Facade.getSfListOfAvailableAttachmentsAsync, to read the list of all available attachments
that can be downloaded.
Note This method is optional and can be used to avoid long sync times
during visits.
The array of the attachment information that is returned is:
Id:
Unique ID of the attachment.
LastModifiedDate: Timestamp of last modification as
Unix
epoch.
Name: Name of the file.
Body: Path of the attachment.
BodyLength: Size of attachment in bytes.
Sample Implementation of the Method
var deferred = when.defer();
Facade.getSfListOfAvailableAttachmentsAsync().then(
function(attachmentData) {
AppLog.info("Number of available attachments: ", attachmentData.length);
var downloadRequest = [];
for (var idx = 0; idx < attachmentData.length; ++idx){
// Request only files that are larger than 2048
if (attachmentData[idx].BodyLength > 2048){
AppLog.info("Requesting: ", attachmentData[idx].Body, " with a size of ", attachmentData[idx].BodyLength);
downloadRequest.push(attachmentData[idx]);
}
}
deferred.resolve(downloadRequest);
}, function(error){
AppLog.error("Could not retrieve attachment list.", error);
deferred.resolve([]);
}
);
var promise = deferred.promise;
Did this article solve your issue?
Let us know so we can improve!
Loading
Salesforce Help | Article
Cookie Consent Manager
General Information
Required Cookies
Functional Cookies
Advertising Cookies
General Information
We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required Cookies
Always Active
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional Cookies
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising Cookies
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.