Posts

How to Query All the batch classes in your Salesforce Instance using APEX

You can use the following scripts to know the batch classes in your Salesforce instance. List asyncApexJobList = [select ApexClassId, Id, JobItemsProcessed, JobType, Status, NumberOfErrors, MethodName from AsyncApexJob where JobType in ('BatchApexWorker','BatchApex')]; List idList = new List (); for(AsyncApexJob eachRecord:asyncApexJobList){ idList.add(eachRecord.ApexClassId); } List apexClassList = [Select Name from ApexClass where Id IN:idList]; for(ApexClass eachApexClass : apexClassList){ System.debug(eachApexClass.Name); } Additionally, You can use above to get all schedulable and other classes by adding the JobType filter. The possible values for JobType are: Future SharingRecalculation ScheduledApex BatchApex BatchApexWorker TestRequest TestWorker ApexToken Queueable Also, you can use the above script to find the status of the job as well by adding a filter on AsyncApexJob. Type. The possible values are: Holding Queued P

Salesforce Trace Log Query Using Apex

Image
To activate debug logging for users, Apex classes, and Apex triggers, configure trace flags and debug levels in the Developer Console or in Setup. Each trace flag includes a debug level, start time, end time, and log type. The trace flag’s log type specifies the entity you’re tracing. You can navigate to Setup->Debug then you will see the below screen for trace logs configured in your instance. If you want to query Trace Log for your instance using Apex then you can use following SOQL query for the same. But please check API Tooling checkbox in developer console while querying. 1. To Query all trace log SELECT Id, CreatedDate, CreatedById, ExpirationDate, LogType,TracedEntityId,TracedEntity.Name, ApexCode, ApexProfiling, Callout, Database, System, Validation, Visualforce, Workflow FROM TraceFlag 2. To Query trace log only for class SELECT Id, CreatedDate, CreatedById, ExpirationDate, LogType,TracedEntityId,TracedEntity.Name, ApexCode, ApexProfiling, Callout,

AJAX Toolkit Debug Shell

You want to browse through the fields, attributes, and relationships of every object in your Salesforce.com organization. There are lots of ways to do this. But I feel productive when I use Ajax Toolkit Debug Shell. To navigate to the Ajax Toolkit Debug shell you please follow the below steps. Step 1: You need to navigate to below URL depending on your environments. Sandbox:  https://test.salesforce.com/soap/ajax/15.0/debugshell.html Production:  https:/login.salesforce.com/soap/ajax/15.0/debugshell.html Developer:  https:/login.salesforce.com/soap/ajax/15.0/debugshell.html Step 2: if it asks you to login then please execute below the line with your credentials. sforce.connection.login("MyName@myISP.com", "myPassword") Step3: To query field of Account, please fire below query. sforce.connection.describeSObject("Account")

Prefix List Of Salesforce Object

Record ID Prefix Decoder Entity Prefix ACCOUNT '001' QUOTE  '0Q0' NOTE '002' CONTACT  '003' USERS '005' OPPORTUNITY  '006' ACTIVITY '007' OPPORTUNITY_HISTORY '008' FORECAST_ITEM '00A' FILTER '00B' DELETE_EVENT '00C' ORGANIZATION '00D' USER_ROLE '00E' QUEUE '00G' GROUPS '00G' PARTNER  '00I' OPPORTUNITY_COMPETITOR '00J'  OPPORTUNITY_CONTACT_ROLE '00K' CUSTOM_FIELD_DEFINITION '00N' REPORT '00O' ATTACHMENT '00P' LEAD '00Q' IMPORT_QUEUE '00S' TASK '00T' EVENT '00U' EMAIL_TEMPLATE '00X' EMAIL_TEMP '00Y' COMMENTS '00a' CUSTOM_RESOURCE_LINK '00b' TRAINING '00c' PROFILE '00e' MH_BLUESHEET '00f' MH_GOLDSHEET '00g' LAYOUT  '00h' PRICEBOOK_MAPPING  '00i' PRICEBOOK_ENTRY_MAPPING '