Skip to content

Instantly share code, notes, and snippets.

<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>50.0</apiVersion>
<isExposed>true</isExposed>
<targets>
<target>lightning__AppPage</target>
<target>lightning__RecordPage</target>
<target>lightning__HomePage</target>
<target>lightning__Tab</target>
</targets>
import { LightningElement, track } from 'lwc';
import getAddressByCoordinatesApex from '@salesforce/apex/BingMapProvider.getAddressByCoordinates';
import getCoordinatesByAddressApex from '@salesforce/apex/BingMapProvider.getCoordinatesByAddressJson';
import getDrivingDistanceApex from '@salesforce/apex/BingMapProvider.getDrivingDistanceJson';
export default class BingMapTest extends LightningElement {
@track isLoading = false;
// address by coordinates
<template>
<template if:true={isLoading}>
<lightning-spinner variant="brand" size="large" alternative-text="Please wait..."></lightning-spinner>
</template>
<div class="slds-card">
<lightning-layout>
<lightning-layout-item padding="around-small">
<lightning-input type="text" label="Latitude" value={latitude} onchange={handleLatitudeChange}></lightning-input>
</lightning-layout-item>
public without sharing virtual class BingMapProvider {
private static String apiEndpoint = 'https://dev.virtualearth.net/REST/v1/';
private static String apiKey = 'YOUR_API_KEY_HERE';
/**
* @description
* Given decimal Lat/Lon coordinates - try to get address details
* makes a call like this:
* http://dev.virtualearth.net/REST/v1/Locations/47.64054,-122.12934?o=json&key={{BingMapsAPIKey}}
*
document.addEventListener("fsl-ready", function(e) {
if (e.detail) {
document.getElementById("load").load = 'Inside e.Detail';
} else {
document.getElementById("load").innerHTML = 'Inside else-load';
}
});
function getPickListValues(objectType, fieldName) {
<html>
<head>
<title>FSL Extension Toolkit</title>
<script src="scripts/fsl.js"></script>
</head>
<body> <pre id="load"></pre> <pre id="picklist"></pre> <pre id="showRecord"></pre> <pre id="query"></pre> <pre id="recordids"></pre>
<button onclick="showRecord('0WO3K0000004S7tWAE','WorkOrder');">Get Record</button>
<button onclick="query('Status','Ready for Assignment','WorkOrder','Select Id FROM WorkOrder');">Execute SOQL</button>
import { LightningElement } from 'lwc';
import {subscribe,unsubscribe,createMessageContext,releaseMessageContext,APPLICATION_SCOPE} from 'lightning/messageService';
import sampleMC from "@salesforce/messageChannel/VFLWC__c";
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
export default class HM_ComponentRefresher extends LightningElement {
subscription = null;
contextvar = createMessageContext();
connectedCallback(){
this.subscribeMsg();
}
<apex:page lightningStylesheets="true" showHeader="false" sidebar="false">
<div class="btn-group">
<button onclick="sendToLWC('Success!',true);">Success!</button>
<button onclick="sendToLWC('Error!',false);">Error!</button>
</div>
<script type="text/javascript">
var MsgChannel = "{!$MessageChannel.VFLWC__c}"; //Message Channel which we created. Acts like a delivery service
<?xml version="1.0" encoding="UTF-8"?>
<LightningMessageChannel xmlns="http://soap.sforce.com/2006/04/metadata">
<description>This Lightning Message Channel is Used for calling LWC Events</description>
<isExposed>true</isExposed>
<lightningMessageFields>
<description>Boolean Check</description>
<fieldName>BoolVal</fieldName>
</lightningMessageFields>
<lightningMessageFields>
<description>Message</description>