From ea85ddfecc9d6ca41ea8e74a7722dc0ba5fc30a0 Mon Sep 17 00:00:00 2001 From: bettyjacobs8 <144233805+bettyjacobs8@users.noreply.github.com> Date: Sun, 17 Mar 2024 11:26:50 +0200 Subject: [PATCH 1/3] Update README.md --- projects/FindNearby/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/FindNearby/README.md b/projects/FindNearby/README.md index fae0c06..e54b1ec 100644 --- a/projects/FindNearby/README.md +++ b/projects/FindNearby/README.md @@ -65,6 +65,6 @@ We recommend taking the [Quick Start: Lightning Web Components](https://trailhea 1. From Setup, in the Quick Find box, enter `Security` and select **Trusted URLs**. 2. Click **New Trusted URL**. 3. Enter an API Name. - 4. For URL, enter `maps.a.forceusercontent.com`. + 4. For URL, enter `maps.a.forceusercontent.com` and `maps.b.forceusercontent.com`. 5. Select **frame-src (iframe content)**. 6. Save your changes. From 97bfcaa5a7d45dc3dd1d33981ad077ea97ac1705 Mon Sep 17 00:00:00 2001 From: bettyjacobs8 <144233805+bettyjacobs8@users.noreply.github.com> Date: Sun, 17 Mar 2024 11:29:52 +0200 Subject: [PATCH 2/3] Update README.md --- projects/FindNearby/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/FindNearby/README.md b/projects/FindNearby/README.md index e54b1ec..0cf63cb 100644 --- a/projects/FindNearby/README.md +++ b/projects/FindNearby/README.md @@ -65,6 +65,7 @@ We recommend taking the [Quick Start: Lightning Web Components](https://trailhea 1. From Setup, in the Quick Find box, enter `Security` and select **Trusted URLs**. 2. Click **New Trusted URL**. 3. Enter an API Name. - 4. For URL, enter `maps.a.forceusercontent.com` and `maps.b.forceusercontent.com`. + 4. For URL, enter `maps.a.forceusercontent.com`. 5. Select **frame-src (iframe content)**. 6. Save your changes. + 7. Repeat these steps for the `maps.b.forceusercontent.com` URL. From 94fea53eafa5a396667ecdba282efad6fdb14370 Mon Sep 17 00:00:00 2001 From: rotem-hen-sf <120910985+rotem-hen-sf@users.noreply.github.com> Date: Sun, 17 Mar 2024 11:50:33 +0200 Subject: [PATCH 3/3] Update README.md Added an additional necessary URL + fixed indentation. --- projects/FindNearby/README.md | 108 +++++++++++++++++----------------- 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/projects/FindNearby/README.md b/projects/FindNearby/README.md index 0cf63cb..91800e4 100644 --- a/projects/FindNearby/README.md +++ b/projects/FindNearby/README.md @@ -15,57 +15,57 @@ We recommend taking the [Quick Start: Lightning Web Components](https://trailhea ## Set Up the LWC -1. Get the source code: - 1. From [LWC-Mobile-Samples](https://github.com/forcedotcom/LWC-Mobile-Samples), click **Code**. - 2. Clone the code or download the zip file. -2. Configure the LWC: - - 1. Open the FindNearby folder in Visual Studio Code. - 2. Under `force-app/main/default/lwc/mobileMapLayersMain`, open the `config.js` file. - 3. Review the predefined code blocks in the mapObjects array. Each code block represents an object that can be displayed on the map. The map shows one type of object at a time, and you can switch between types. By default, the object type you see when you launch the LWC is the first code block of the mapObjects array. According to the default configuration of the LWC, the displayed object is Service Appointment. - - `value`—The object’s name. - - `latField`—The object’s field that contains the latitude value. - `longField`—The object’s field that contains the longitude value. - `titleField`—The value of the entered field is displayed as the title of the marker’s card and list entry. - `detailField`—The value of the entered field is displayed as the detail of the marker’s card and list entry. - - Example: - ``` - { - value: 'ServiceAppointment', - latField: 'Latitude', - longField: 'Longitude', - titleField: 'AppointmentNumber', - detailField: 'Subject' - } - ``` - According to this code block: the map shows markers for service appointments; the service appointments are located on the map according to their latitude and longitude; the appointment number is the title of the card and the list entry; and the subject is the detail shown in the card and the list entry. - - - 4. Add a code block for every object type you want to see on the map. - * Within a code block, use different fields for `latField`, `longField`, `titleField`, and `detailField`. For example, you can't use the Name field for both `titleField` and `detailField`. - * Separate the code blocks using a comma. - - 5. The distance unit is predefined as kilometers. To change the distance unit to miles, replace km with mi: - - `distanceUnit: 'mi'` - -3. Authorize your org and deploy the code to your org. See [Quick Start: Lightning Web Components](https://trailhead.salesforce.com/content/learn/projects/quick-start-lightning-web-components). -4. Grant access to the LWC’s users. - 1. From Setup, in the Quick Find box, enter `Users`, and then select **Profiles**. - 2. Open the required profile. - 3. Under Enabled Apex Class Access, click **Edit** and add MobileMapLayersService. - 4. Give the users access to the records you want them to see. -5. Connect the LWC to a global action. See Add Global Actions to the Field Service Mobile App. - 1. For Action Type, select **Lightning Web Components**. - 2. For Lightning Web Component, select **c:mobileMapLayersMain**. -6. To see the map on a mobile device, add the map URL to the org’s trusted URLs. For more information, see [lightning-map](https://developer.salesforce.com/docs/component-library/bundle/lightning-map/documentation). - 1. From Setup, in the Quick Find box, enter `Security` and select **Trusted URLs**. - 2. Click **New Trusted URL**. - 3. Enter an API Name. - 4. For URL, enter `maps.a.forceusercontent.com`. - 5. Select **frame-src (iframe content)**. - 6. Save your changes. - 7. Repeat these steps for the `maps.b.forceusercontent.com` URL. +1. Get the source code: + 1. From [LWC-Mobile-Samples](https://github.com/forcedotcom/LWC-Mobile-Samples), click **Code**. + 2. Clone the code or download the zip file. +2. Configure the LWC: + + 1. Open the FindNearby folder in Visual Studio Code. + 2. Under `force-app/main/default/lwc/mobileMapLayersMain`, open the `config.js` file. + 3. Review the predefined code blocks in the mapObjects array. Each code block represents an object that can be displayed on the map. The map shows one type of object at a time, and you can switch between types. By default, the object type you see when you launch the LWC is the first code block of the mapObjects array. According to the default configuration of the LWC, the displayed object is Service Appointment. + - `value`—The object’s name. + - `latField`—The object’s field that contains the latitude value. + - `longField`—The object’s field that contains the longitude value. + - `titleField`—The value of the entered field is displayed as the title of the marker’s card and list entry. + - `detailField`—The value of the entered field is displayed as the detail of the marker’s card and list entry. + + Example: + + ```json + { + "value": "ServiceAppointment", + "latField": "Latitude", + "longField": "Longitude", + "titleField": "AppointmentNumber", + "detailField": "Subject" + } + ``` + + According to this code block: the map shows markers for service appointments; the service appointments are located on the map according to their latitude and longitude; the appointment number is the title of the card and the list entry; and the subject is the detail shown in the card and the list entry. + + 4. Add a code block for every object type you want to see on the map. + + - Within a code block, use different fields for `latField`, `longField`, `titleField`, and `detailField`. For example, you can't use the Name field for both `titleField` and `detailField`. + - Separate the code blocks using a comma. + + 5. The distance unit is predefined as kilometers. To change the distance unit to miles, replace km with mi: + + `distanceUnit: 'mi'` + +3. Authorize your org and deploy the code to your org. See [Quick Start: Lightning Web Components](https://trailhead.salesforce.com/content/learn/projects/quick-start-lightning-web-components). +4. Grant access to the LWC’s users. + 1. From Setup, in the Quick Find box, enter `Users`, and then select **Profiles**. + 2. Open the required profile. + 3. Under Enabled Apex Class Access, click **Edit** and add MobileMapLayersService. + 4. Give the users access to the records you want them to see. +5. Connect the LWC to a global action. See Add Global Actions to the Field Service Mobile App. + 1. For Action Type, select **Lightning Web Components**. + 2. For Lightning Web Component, select **c:mobileMapLayersMain**. +6. To see the map on a mobile device, add the map URL to the org’s trusted URLs. For more information, see [lightning-map](https://developer.salesforce.com/docs/component-library/bundle/lightning-map/documentation). + 1. From Setup, in the Quick Find box, enter `Security` and select **Trusted URLs**. + 2. Click **New Trusted URL**. + 3. Enter an API Name. + 4. For URL, enter `maps.a.forceusercontent.com`. + 5. Select **frame-src (iframe content)**. + 6. Save your changes. + 7. Repeat these steps for the `maps.b.forceusercontent.com` URL.