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
          Create an External File

          Create an External File

          Create a zip of the base-64 encoded string format of the custom font and its license. Append the base-64 encoded string format of the zip file in an external file in VS Code based Modeler.

          Required Editions

          • Download the desired font-style data file (for example, .ttf) and its corresponding license file to a local drive.
          • Convert the font style data to a base-64 encoded string format. For example, to convert NotoSerifKorean-Regular.ttf to a base-64 encoded string, run this command in your VS Code based Modeler: sf modeler workspace utils base64encode --input ./NotoSerifKorean-Regular.ttf > ./NotoSerifKorean-Regular.txt
          Available in Lightning Experience in Professional, Enterprise, and Unlimited Editions that have Consumer Goods Cloud enabled.
          User Permissions Needed
          To create an external file: CGCloud Business Admin
          1. To create a Printfont.js file, in a text editor, copy the code snippet for the preferred font type configuration from the Sample Code for PrintFont.js section and save it as a JavaScript file.
          2. In the Printfont.js file, add the base-64 encoded string of the font type data. In this example, PrintFont.js uses a single font type configuration.
            "use strict";
            //define required font types
            const regularFont = "#base64-encoded regular PrintFont data#"
            
            //build object using font types and return
            return{
             "Regular": regularFont,
             "Italic": regularFont,
             "Bold": regularFont,
             "BoldItalic": regularFont
             } ;
          3. Save your changes.
          4. Create a zip archive of the Printfont.js and License.txt files.
          5. Convert the zip file to a base-64 encoded string format in a text file by using this command in your VS Code based Modeler: sf modeler workspace utils base64encode --input ./MyPrintFont_Korean.zip > ./MyPrintFont_Korean.txt
          6. Create an external file contract for the custom font by using the template $workspace/contractSnippets/ExternalFiles/#Name#.externalfile.xml in your VS Code based Modeler. For example, MyPrintFont_Korean.externalfile.xml.
          7. Add the base-64 encoded string from MyPrintFont_Korean.txt to the CDATA block in the content element of the ExternalFile contract.
            Here’s the code snippet template. followed by a sample ExternalFile configuration.
            <ExternalFile name="#Name#" npmName="#NpmName#" displayName="#Your Description#" version="#Version#" availableForUI="true">
                <Content>
                    <!-- CDATA Block with base-64 string of the lib -->
                    <![CDATA[#Base64String#]]>
                </Content>
            </ExternalFile>
            <ExternalFile name="MyPrintFont_Korean" npmName="MyPrintFont_Korean" displayName="MyPrintFont - Korean" version="1.0.0" availableForUI="true">
                <Content>
                     <![CDATA[SampleStringARqSPRr7™/9zsDvZ5n₴28tS$CAnPqdREPtTj5aLYBTyA/gL42CUGL7A0KfGoy4f{yDP16xqH3[mXWCTLwExgLgyakSeR=9udCqc1VUBQADVx212nV4CMABBBAAAEFAAAAFBLAQIAxQAAAAIAIt6xFj34hn3vQCAAIERAAALABgAACAKMAAADI/UBAAAA]]>
                </Content>
            </ExternalFile>
          8. Save your changes.
          9. Copy the custom font external file contract to $workspace/src/ExternalFiles in your VS Code based Modeler.
          10. Build the contracts by using this command: sf modeler workspace build.
           
          Loading
          Salesforce Help | Article