Loading
Feature Disruption - Service Cloud VoiceRead More
Feature degradation | Gmail Email delivery failureRead More
Visual Studio Code Based Modeler for Consumer Goods Cloud
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          Direct Download of Attachments

          Direct Download of Attachments

          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
          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;
          
           
          Loading
          Salesforce Help | Article