//Get all scheduled jobs
List<CronTrigger> ctList = [SELECT Id, CreatedDate, CronExpression, CronJobDetailId, EndTime,
NextFireTime, OwnerId, PreviousFireTime, StartTime, State,
TimesTriggered FROM CronTrigger];
//Abort all jobs one by one
for(CronTrigger ct:ctList){
System.abortJob(ct.Id);
}
We use {!$Label.CustomLabelName}, when we call custom label in Visualforce page JavaScript function. But if we need to access custom labels in JavaScript file in static resource, then here is the way to get the custom label value.
Load the custom label in Visualforce Page before loading the static resource JavaScript file.
In this example we will fetch Picklist field “Industry” values from “Account” object and set in ui:inputSelect on Lightning Component.
Apex Class:
public class GetPicklistValuesController {
@AuraEnabled
public static List <String> getPicklistValues(sObject obj, String fld) {
List <String> pList = new list <String>();
//Get the object type of the SObject.
Schema.sObjectType objType = obj.getSObjectType();
//Describe the SObject using its object type.
Schema.DescribeSObjectResult objDescribe = objType.getDescribe();
//Get a map of fields for the SObject
Map<String, Schema.SObjectField> fieldMap = objDescribe.fields.getMap();
//Get the list of picklist values for this field.
List<Schema.PicklistEntry > values = fieldMap.get(fld).getDescribe().getPickListValues();
//Add these values to the selectoption list.
for (Schema.PicklistEntry a: values) {
pList.add(a.getValue());
}
pList.sort();
return pList;
}
}