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
handleSelect : function (component, event, helper) { | |
var stepName = event.getParam("detail").value; | |
component.set("v.picklistField.status",stepName); | |
component.find("record").saveRecord($A.getCallback(function(saveResult) { | |
if (saveResult.state === "SUCCESS" || saveResult.state === "DRAFT") { | |
component.find('notifLib').showToast({ | |
"variant": "success", | |
"message": "Record was updated sucessfully", | |
"mode" : "sticky" |
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
<aura:component implements="flexipage:availableForAllPageTypes,force:hasRecordId" access="global" > | |
<lightning:notificationsLibrary aura:id="notifLib"/> | |
<aura:attribute name="picklistField" type="object"/> | |
<force:recordData aura:id="record" | |
layoutType="FULL" | |
recordId="{!v.recordId}" | |
targetFields="{!v.picklistField}" | |
mode="EDIT"/> | |
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
sortData: function (cmp, fieldName, sortDirection) { | |
var data = cmp.get("v.mydata"); | |
var reverse = sortDirection !== 'asc'; | |
data.sort(this.sortBy(fieldName, reverse)) | |
cmp.set("v.mydata", data); | |
}, | |
sortBy: function (field, reverse, primer) { | |
var key = primer ? | |
function(x) {return primer(x[field])} : | |
function(x) {return x[field]}; |
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
@AuraEnabled public static lightningTableWraper getsObjectRecords(String ObjectName,String fieldstoget){ | |
List<String> lstfieldstoget = fieldstoget.split(','); | |
List<lightningTableColumnWrapper> lstTableColumn = new list<lightningTableColumnWrapper> (); | |
DescribeSObjectResult objResult = Schema.getGlobalDescribe().get(ObjectName).getDescribe(); | |
for(String field : lstfieldstoget){ | |
lightningTableColumnWrapper colWrapper = new lightningTableColumnWrapper(); | |
DescribeFieldResult fieldResult = objResult.fields.getMap().get(field).getDescribe(); |
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
<lightning:datatable data="{!v.mydata}" columns="{!v.mycolumn}" | |
onsort="{!c.updateColumnSorting}" sortedBy="{!v.sortedBy}" | |
sortedDirection="{!v.sortedDirection}" onrowselection="{!c.getSelectedName}" | |
keyField="Id"/> |
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
getLightningTableData : function(component) { | |
var sColumn = component.get("v.fields"); | |
var sObject = component.get("v.object"); | |
var action = component.get("c.getsObjectRecords"); | |
action.setParams({ | |
ObjectName : sObject, | |
fieldstoget : sColumn | |
}); | |
action.setCallback(this,function(response){ | |
var state = response.getState(); |
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
Database.Query('Select Id,Name,(select Id,subject,Account.Name,Status,priority from Tasks where remindatalocation__c = True and isClosed = False) | |
from Account where Distance(BillingAddress,Geolocation('+lati+','+longi+'),\'mi\') < 20 limit 10'); |
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
doinit : function(component, event, helper) { | |
if(navigator.geolocation){ | |
navigator.geolocation.getCurrentPosition(function(position){ | |
component.set("v.comLat",position.coords.latitude); | |
component.set("v.comLong",position.coords.longitude); | |
}); | |
} | |
} |
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 littleBitsLEDhelper { | |
@future(callout=True) | |
public static void turnOnLED(){ | |
Http h = new Http(); | |
HttpRequest req = new HttpRequest(); | |
req.setMethod('POST'); | |
req.setEndpoint('https://api-http.littlebitscloud.cc/devices/<deviceID>/output'); | |
req.setHeader('Authorization','Bearer <AccessToken>'); | |
req.setHeader('Accept', 'application/vnd.littlebits.v2+json'); | |
req.setBody('percent=100&duration_ms=32000' ); |
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
trigger LEDlights on FeedItem (after insert) { | |
for(FeedItem fdi : Trigger.New){ | |
if(String.Valueof(fdi.body).touppercase().contains('#LIGHTON') ){ | |
littleBitsLEDhelper.turnOnLED(); | |
} | |
else if(String.valueof(fdi.body).touppercase().contains('#LIGHTOFF')){ | |
littleBitsLEDhelper.turnOffLED(); | |
} |
NewerOlder