You are here:
Activate Custom Font
The setup of a custom font depends on your project requirement or usecase. This sample
implementation uses a custom businesslogic method (setPrintFont) that is configured in a business object (BoUSer) to determine the custom font to use through the Facade.setPrintFont API.
Required Editions
| Available in Lightning Experience in Professional, Enterprise, and Unlimited Editions that have Consumer Goods Cloud enabled. |
| User Permissions Needed | |
|---|---|
| To activate a custom font: | Customizer, Admin |
-
In your project in VS Code based Modeler, add a business logic method to the
BoUser module by using the
sf modeler workspace addcommand. For example:? Select the resource you want to add. businesslogic ? Specify a name for the businesslogic: SetPrintFont ? Select the module to which businesslogic 'SetPrintFont' should be added. User ? Select a suitable option for businesslogic 'SetPrintFont'. method ? Select the reference object to which you want to add the businesslogic method.BoUser ? Do you really want to create the businesslogic 'SetPrintFont'? Yes Successfully created businesslogic 'BoUser.MySetPrintFont'. */Users/abc/modeler_abc/src/User/BO/BoUser/Mv1/BoUser.MySetPrintFont.bl.js * /Users/abc/modeler_abc/src/User/BO/BoUser/BoUser.businessobject.xml -
Define the
SetPrintFontfunction in the method file. Here’s a sample configuration of BoUser.MySetPrintFont.bl.js.function mySetPrintFont() { var me = this; //set custom printfont, e.g. based on user locale/sales org / etc. var printFont = 'MyPrintFont_Korean'; if (Utils.isDefined(printFont)) { Facade.setPrintFont(printFont); } } - Save your changes.
-
To invoke the
MySetPrintFontbusiness logic function, add an action in Application_StartProcess.processflow.xml at $workspace/src/Application/PR/Application_Start, and then integrate the action to transition to theSetPrintFontfunction in the existing process action flow. For example:<Action name="PostSfLogin" actionType="LOGIC" call="ApplicationContext::User.login"> <TransitionTo action="SetPrintFont" /> <!-- previously: LoadSfUserFavorites --> </Action> <Action actionType="LOGIC" name="SetPrintFont" call="ApplicationContext::User.mySetPrintFont"> <!- Facade.setPrintFont--> <TransitionTo action="LoadSfUserFavorites" /> </Action> <Action name="LoadSfUserFavorites" actionType="LOGIC" call="Facade. loadAdvancedSearchFavoritesAsync"› <TransitionTo action="LoadLuSalesOrg" /> </Action> - Save your changes.
-
Build the contracts by using this command:
sf modeler workspace build. -
To test your changes in the simulator app, start the server by using this command:
sf modeler workspace server start. - To verify that the PDF report appears in the configured custom font, generate a print preview of an order in the simulator app.
-
If you’re satisfied with the preview, deploy the custom print fonts to CG Cloud offline
mobile app on sales reps’ devices. To generate the deployment package, run:
sf modeler workspace package.
See Also
Did this article solve your issue?
Let us know so we can improve!

