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 SK_AttachmentJSONParser { | |
public Integer totalSize; | |
public boolean done; | |
public cls_records[] records; | |
public class cls_records { | |
public String Id; | |
public string ParentId; | |
public String Name; | |
} | |
} |
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 static string finalCSVString ='Id,Name,Value\n'; | |
findAllCustomLabels(''); | |
public static void findAllCustomLabels(string endpointURL){ | |
if(endpointURL=='' || endpointURL==null){ | |
endpointURL='/services/data/v45.0/tooling/query/?q=Select+id,Name,Value+from+CustomLabel'; | |
} | |
HttpRequest req = new HttpRequest(); | |
req.setHeader('Authorization', 'Bearer ' + UserInfo.getSessionID()); | |
req.setHeader('Content-Type', 'application/json'); |
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 SK_BoxAPIUtility { | |
//static method to get access token from refresh token | |
public static List<string> regenerateAccessToken(string clientId, string clientSecret, string refresh_token){ | |
list<string> tokenlist = new List<string>(); | |
HttpRequest req = new HttpRequest(); | |
string endpointUrl='https://api.box.com/oauth2/token'; | |
req.setbody('grant_type=refresh_token'+ | |
'&refresh_token='+refresh_token+ | |
'&client_id='+clientId+ | |
'&client_secret='+clientSecret); |
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 SK_CustomlabelUtility { | |
public static string finalCSVString ='Id,Name,Value\n'; | |
//variables to parse customlabel json response | |
public Integer size; | |
public Integer totalSize; | |
public boolean done; | |
public String nextRecordsUrl; | |
public String queryLocator; | |
public String entityTypeName; |
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
String qstring ='Select id,Name,(select id,Lastname,Email from Contacts),(Select id,Name,Stagename from Opportunities) from Account where id=\'00190000004Awos\' Limit 1'; | |
List<sobject> sobjectList = database.query(qstring); | |
for(sObject sb:sobjectList){ | |
System.debug('****Parent record-Account details:'+sb.get('Name')); | |
//check if account has any contact child records | |
List<sobject> contactChildObjects = sb.getSobjects('Contacts'); | |
System.debug('****Child Contact Records size:'+contactChildObjects.size()); | |
if(contactChildObjects.size()>0){ | |
for(sobject con:contactChildObjects){ | |
system.debug('Contact Id:'+ con.get('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
//------------Accessing parent field values in child to parent dynamic query---- | |
//Below is static method which can be used to fetch field values. | |
//You need to pass sObject and fieldAPIName to get field value | |
public static string ExtractFieldValues(sObject sb, string fieldAPIName){ | |
string fvalue=''; | |
if(fieldAPIName.contains('.')){ | |
List<string> splitedFields = fieldAPIName.split('\\.'); | |
try{ | |
for(integer i=0;i<splitedFields.size()-1;i++){ | |
sb=sb.getSobject(splitedFields[i]); |
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 SK_AccountProcessBatch implements Database.Batchable<sObject>,Database.Stateful,Database.RaisesPlatformEvents{ | |
global List<string> errorRecordsId=new List<String>(); | |
global Database.QueryLocator start(Database.BatchableContext BC){ | |
return Database.getQueryLocator('Select id,name,Type,rating,industry from Account Limit 1000'); | |
} | |
global void execute(Database.BatchableContext BC, List<sObject> scope){ | |
List<Account> accountListForUpdate = new List<Account>(); | |
for(sobject s : scope){ | |
Account acc =(Account)s; |
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
string parentObjectName ='Account';//Specify Object API Name | |
string parentRecordId = '0019xxxxxxx7MqU'; //Specify record Id | |
//to store childRelationShipName | |
Map<integer,List<string>> childObjectmap = new Map<integer,List<string>>(); | |
//to store inner query string for child objects | |
Map<integer,List<string>> childObjectQStringmap = new Map<integer,List<string>>(); | |
Map<String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe(); | |
for(String ss1: schemaMap.keyset()){ | |
Schema.SObjectType objToken=schemaMap.get(ss1); | |
if(ss1.equalsignorecase(parentObjectName)){ |
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
String parentObjectName = 'Account'; | |
Map<string,string> objectRelationshipMap = new Map<string,string>(); | |
Map<String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe(); | |
for(String ss1: schemaMap.keyset()){ | |
Schema.SObjectType objToken=schemaMap.get(ss1); | |
if(ss1.equalsignorecase(parentObjectName)){ | |
//find details about sobject | |
Schema.DescribeSObjectResult objDescribe=objToken.getdescribe(); | |
List<Schema.ChildRelationship> childRelationshipList = objDescribe.getChildRelationships(); | |
system.debug('******childRelationshipList.size():'+childRelationshipList.size()); |
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="force:appHostable,flexipage:availableForAllPageTypes" access="global" > | |
<lightning:notificationsLibrary aura:id="notifLib"/> | |
<lightning:button name="toast" label="Display Toast" onclick="{!c.showToast}"/> | |
</aura:component> |