Loading
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
          Add a Method to Launch Google Maps

          Add a Method to Launch Google Maps

          In your Consumer Goods Modeler workspace, add a method to the Display module to launch a third-party app from the Consumer Goods offline mobile app. Sales reps can tap the maps app launch button in CG offline mobile app to launch apps such as Google Maps. Customize the business logic method to pass the latitude and longitude parameters, so that sales reps navigate to the correct coordinates.

          Required Editions

          Available in: Professional, Enterprise, and Unlimited Editions that have Consumer Goods Cloud enabled
          User Permissions Needed
          To add a method to launch Google Maps: CG Cloud Developer, Admin
          Note
          Note If you’re a Salesforce developer or a partner developer, make sure you don’t pass any sensitive information to the third-party app.
          1. To create a business logic method to open Google Maps, open the VS Code terminal, run sf mdl add, and enter these details.
            ? Select the resource you want to add: businesslogic
            ? Specify a name for the business logic: NavigateTo
            ? Select the module to which the NavigateTo business logic is added: MyDisplay
            ? Select a suitable option for the NavigateTo business logic: async method
            ? Select the reference object to add the business logic method: BoMyDisplays
            
          2. In the customization range of the new business logic method, enter this code.
            var customer = me.getLuCustomer();
            let latitude =0;
            let longitude= 0;
            if (customer) {
              latitude=customer.getLatitude();
              longitude=customer.getLongitude();
            }
            const url = `http://maps.google.com/maps?mode=d&daddr=${latitude}+${longitude}`;
            var promise = Facade.startThirdPartyAsync(url,{});
          3. Save your changes.
          4. Build your contracts to check for validation errors. Run sf mdl build.
           
          Loading
          Salesforce Help | Article