Salesforce Apex Interview Questions & Answers

Поділитися
Вставка
  • Опубліковано 2 лют 2025

КОМЕНТАРІ • 47

  • @rangurajeevkumar1694
    @rangurajeevkumar1694 6 місяців тому +5

    this ans is for Account a =[SELECT Name FROM Account WHERE industry='Energy']; ---->System.QueryException: List has more than 1 row for assignment to SObject --->reason--> storing list of records into single variable.

  • @AnbalaganK-g8f
    @AnbalaganK-g8f 6 місяців тому +1

    It may throw the query exception. More than one record to a singleton sObject variable.

  • @SalesforceMiind
    @SalesforceMiind 5 місяців тому +2

    Hi Ankit, 🙌 Kudos to you for all the good work you have been doing! . Could you please create a separate video for "Apex replay debugger" ?

  • @user-jb6cn9ej5m
    @user-jb6cn9ej5m 5 місяців тому +3

    // Collect all Account IDs from the trigger
    Set accountIds = new Set();
    for (Account acc : Trigger.new) {
    accountIds.add(acc.Id);
    }
    // Query all Contacts related to the Accounts in the trigger
    List conList = [SELECT Id, AccountId FROM Contact WHERE AccountId IN :accountIds];
    // Process each Contact
    for (Contact con : conList) {
    // Your logic here
    }

  • @sriharshithareddy7115
    @sriharshithareddy7115 6 місяців тому +1

    1. DML Exception - Required Field Missing (LastName)
    2. QueryException - No records returned or trying to assign more than 1 record to a singleton sObject Account variable.

  • @vaibhavchaubey4748
    @vaibhavchaubey4748 6 місяців тому +1

    Thank you sir 🙏

  • @Mucherlasivaji-z4y
    @Mucherlasivaji-z4y 5 місяців тому

    tqq Ankit sharing informatic videos

  • @gomathihariharan9464
    @gomathihariharan9464 3 місяці тому

    Ankit, great content. Pls do create a video on the apex replay debugger. It would be really helpful.

  • @janac7510
    @janac7510 6 місяців тому +1

    Nice

  • @kaustubhpatne6320
    @kaustubhpatne6320 6 місяців тому

    In 1st scenario
    Where you iterate over accounts
    Mistake is that
    Dml statement used inside for loop
    So to overcome this use separate list and insert list outside for loop

  • @praveenyarnal6587
    @praveenyarnal6587 2 місяці тому

    Thank you sir, please create a video on Apex Replay Debugger

  • @bbk9988
    @bbk9988 6 місяців тому

    Nice video 👍 waiting for the videos on triggers batch apex and other concepts 😊

  • @ravigrover1923
    @ravigrover1923 6 місяців тому

    Set accSet = new Set();
    for (Account acc : trigger.new){
    accSet.add(acc.Id);
    // do some processing there
    }
    List conList = [SELECT Id,FirstName,LastName FROM Contact WHERE AccountId IN : accSet];
    for (Contact con : conList){
    // do some processing there
    }

  • @ravigrover1923
    @ravigrover1923 6 місяців тому +1

    DMl Exception: Required Field(Last Name) is mIssing

  • @awesomekj5812
    @awesomekj5812 6 місяців тому

    Curious ..have you done the video on Apex Replay Debugger ?
    Also for last question --> will you get LIST HAS NO ROWS FOR ASSIGNMENT TO SObject error ??? And we can fix it by converting that account instance to List

  • @kishorey7335
    @kishorey7335 6 місяців тому +2

    set accId=new set();
    for(Account a:trigger.new){
    accId.add(a.Id);
    }
    list conlist=[select Id,AccountId from contact where AccountId in:accId];
    for(contact con:conlist){

    }

  • @ravigrover1923
    @ravigrover1923 6 місяців тому +1

    QueryList Exception : List has no rows exception, store it in a list

  • @haribabuk5162
    @haribabuk5162 2 місяці тому

    hi Ankith , can you please mention the link apex debugger it would bre useful

    • @TechJourneyWithAnkit
      @TechJourneyWithAnkit  2 місяці тому

      How to debug Apex Code in salesforce #salesforce #apex
      ua-cam.com/video/lj4eUDt_-sE/v-deo.html

  • @mohd.arshad1315
    @mohd.arshad1315 6 місяців тому

    Hi Ankit, You are doing a great job for the community, my request to you is that I can get the list of questions and answers you are preparing in the form of a PDF

  • @naveenyalamala
    @naveenyalamala 6 місяців тому

    Is it possible to call Batch class from a future call?

  • @abisheakramasamy5871
    @abisheakramasamy5871 6 місяців тому +1

    How to get job as freshers in Salesforce developer

    • @TechJourneyWithAnkit
      @TechJourneyWithAnkit  6 місяців тому

      Get admin skills strong and have sound knowledge of Apex and LWC. With overview of Integration

  • @vaibhavchaubey4748
    @vaibhavchaubey4748 6 місяців тому +1

    required field is missing in last question , cont.LastName

    • @TechJourneyWithAnkit
      @TechJourneyWithAnkit  6 місяців тому

      Please tell me the name of exception

    • @rangurajeevkumar1694
      @rangurajeevkumar1694 6 місяців тому

      ​@@TechJourneyWithAnkit
      System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [LastName]: [LastName]

  • @mr.mrs.khandal9658
    @mr.mrs.khandal9658 6 місяців тому

    Please create a vedio on apex reply debug.

    • @TechJourneyWithAnkit
      @TechJourneyWithAnkit  6 місяців тому

      Sure I will plan for it

    • @darshanshanbhag7332
      @darshanshanbhag7332 5 місяців тому

      @@TechJourneyWithAnkit Even I am expecting a video on Apex replay debugger. So, Kindly make a video on that as well. Thanks in Advance

  • @sriharshithareddy7115
    @sriharshithareddy7115 6 місяців тому

    for(Account a : [SELECT Id, (SELECT Id FROM Contacts) FROM Account WHERE Id IN :Trigger.New]{
    for(Contacts con : a.Contacts){
    //Some contact processing
    }
    }