Loading
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
          Sync Display Attachments with Named Fetch Trees

          Sync Display Attachments with Named Fetch Trees

          To sync display data and images to the Consumer Goods offline mobile app, add images as attachments and create a named fetch tree for the display object in Consumer Goods Cloud. Sync the attachments and define how to show them on a new tab using a named fetch tree in the Sync Management app.

          Required Editions

          Available in: Lightning Experience

          Available in: Enterprise and Unlimited Editions where Consumer Goods Cloud is enabled

          User Permissions Needed
          To configure file related list and add image as icon

          CGCloud Business Admin

          1. From the object management settings for Display, go to Page Layouts.
          2. Select Display Layout and then click Related Lists.
          3. Drag Files to the Related Lists section.
          4. Save your changes.
          5. Attach sample images to a display record.
            1. In the Display tab, open multiple display records.
            2. In the Related tab of a display record, upload few sample JPG files as image attachments.
            3. Save your changes.
          6. Create an named fetch tree query for Display records, including the attachments.
            1. In Sync Configuration, click Named Fetched Tree.
            2. Click New and enter these details:
              Field Value
              Fetch Tree Name NFT_Display
              Object Name Display__c
              Join Field Account__c
              Where Sales_Org__c = $User.cgcloud__Sales_Org__c
            3. Save your changes and click Back.
          7. Create a second level in the named fetch tree.
            1. Click plus (+) in NFT_Display and enter these details:
              Field Value
              Object Name ContentDocumentLink
              Join Field LinkedEntityId
              Parent Join Field Id
            2. Save your changes and click Back.
            3. Add additional nested levels to the named fetch tree with a specific configuration at each level.
              The nested named fetch tree queries.
            4. Save your changes and click Back.
          8. Test the named fetch tree configuration and review the attachments that will be synchronized for a list of account IDs.
            1. To evaluate the record, in the NFT_Display row, click This gear icon opens the evaluation page for a named fetch tree..
            2. On the Evaluate NFT (NFT_Display ) page, in Root Ids, enter a comma-separated list of account IDs.
            3. In Replace $user Macro with, select a sales rep user.
            4. Click Execute.

              The Results section lists the records for each level to be sync.

              The output view after evaluating the named fetch tree for display records and respective attachments.
            5. Save your changes and click Back.
          9. To sync the display records and the attachments using named fetch tree, disable the Display tracked object.
            1. In the Sync Configuration tab, click Tracked Objects.
            2. To deactivate the Display tracked object, on the Tracked Object page, in the list of tracked objects, next to Display, click This green check mark indicates that the tracked object is active..
          10. To trigger the loading of the named fetch tree from the offline mobile app, configure the ReplicationCallback function.
            Named fetch trees aren't loaded automatically during each sync. Trigger them manually from the offline mobile app after sync.
            1. In Visual Studio Code based Modeler, open BoSfReplicationCallbacks.RequestOnDemandDataAsync.bl.js.
            2. Add a function loadCustomerDisplay parallel to loadCustomerSalesFolder.
              ​​var loadCustomerDisplay = function (result) {
                idsOfAccountDisplayForSync = me.removeLocalIDs(me.getPropertyValuesFromArray(result.ManagedCustomers, "AccountID"));
                if (idsOfAccountSalesFolderForSync.length > 0) {
                  request.addRequest('NFT_Display', idsOfAccountDisplayForSync);
                }
              };
            3. Add the call of the loadCustomerDisplay function with the signature in this format: function(result){: loadCustomerDisplay(result);
              This code snippet demonstrates calling of the loadCustomerDisplay function with the signature.
           
          Loading
          Salesforce Help | Article