This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class StreetLayerAddressAutoCompleteAPI { | |
| // Street Layer: https://streetlayer.com/ | |
| // Documentation: https://streetlayer.com/documentation | |
| public List<String> getAddressAutoComplete(String input, String countryCode) { | |
| string responseData = makeAPICall(input, countryCode); | |
| AutoCompleteResponse response = (AutoCompleteResponse)JSON.deserialize(responseData, AutoCompleteResponse.class); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class GetAddressAPI { | |
| // Get Address API: https://getaddress.io/ | |
| // Documentation: https://getaddress.io/Documentation | |
| public String getAddresses(String postcode) { | |
| if (postcode == null) { | |
| return null; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class GoogleMapsAutoCompleteAPI { | |
| // Google Maps API Place Autocomplete | |
| // Documentation: https://developers.google.com/places/web-service/autocomplete | |
| public PlaceAutocompleteResponse getAutoComplete(String input, String types, String components) { | |
| String url = 'https://maps.googleapis.com/maps/api/place/autocomplete/json?input=' | |
| + EncodingUtil.urlEncode(input, 'UTF-8') | |
| + '&components=' + components // country:uk' | |
| + '&types=' + types |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class GoogleMapsGeocodeApi { | |
| public string geocode(String address){ | |
| String url = 'https://maps.googleapis.com/maps/api/geocode/json?address=' | |
| + EncodingUtil.urlEncode(address, 'UTF-8') | |
| + '&components=country:GB' | |
| + '&key=' + getGoogleMapsAPIKey(); | |
| return getHttp(url); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| exampleJavaScriptMethod : function(cmp, value1, value2) { | |
| var action = cmp.get("c.exampleApexControllerMethod"); | |
| action.setParams({'param1': value1, 'param2': value2 }); | |
| action.setCallback(this, function(response) { | |
| var state = response.getState(); | |
| console.log('exampleJavaScriptMethod state: ' + state); | |
| if(cmp.isValid() && state === "SUCCESS"){ | |
| var result = response.getReturnValue(); | |
| console.log(result); | |
| // do something |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Documentation: https://developer.salesforce.com/docs/component-library/bundle/force:showToast/specification | |
| // type: 'error', 'warning', 'success', or 'info' | |
| showToast : function(title, message, type, icon) { | |
| var toastEvent = $A.get("e.force:showToast"); | |
| toastEvent.setParams({ | |
| title : title, | |
| message: message, | |
| duration: '2000', | |
| key: icon, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| getQueryStringParameter : function(name) { | |
| var url = decodeURIComponent(window.location.search.substring(1)); | |
| var params = url.split('&'); | |
| for (var i = 0; i < params.length; i++) { | |
| var p = params[i].split('='); | |
| if (p[0] === name) { | |
| return p[1] === undefined ? true : p[1]; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| callAjax : function(method, url, async, callback) { | |
| var request = new XMLHttpRequest(); | |
| request.onreadystatechange = function(component) { | |
| if (request.readyState == 4 ) { | |
| callback.call(this, request); | |
| } | |
| }; | |
| request.open(method, url, async); | |
| request.send(); | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| global class DeleteRecordAction { | |
| @InvocableMethod(label='Delete Record') | |
| global static void deleteRecords(List<DeleteRecordActionRequest> requests) { | |
| for(DeleteRecordActionRequest request : requests){ | |
| deleteRecord(request); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| global class EmailAction { | |
| @InvocableMethod(label='Send Email') | |
| global static List<EmailActionResult> sendEmails(List<EmailActionRequest> requests) { | |
| List<EmailActionResult> results = new List<EmailActionResult>(); | |
| for(EmailActionRequest request : requests){ | |
| results.add(sendEmail(request)); | |
| } |
OlderNewer