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 |
-
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
-
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,{});
-
Save your changes.
-
Build your contracts to check for validation errors. Run
sf mdl
build.