Biswajeet is my Name, Success is my Aim and Challenge is my Game.
Risk & Riding is my Passion and Hard Work is my Occupation.
Love is my Friend, Perfection is my Habit and Smartness is my Style.
Smiling is my Hobby, Politeness is my Policy and Confidence is my Power.
//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;
}
}