Salesforce Apex Interview Questions & Answers

Поделиться
HTML-код
  • Опубликовано: 31 окт 2024

Комментарии • 27

  • @vikashchowdhary1670
    @vikashchowdhary1670 3 месяца назад +2

    Yes, using PermissionSetAssignment object, we can assign the permission set to user via apex

  • @ravigrover1923
    @ravigrover1923 3 месяца назад +2

    code written in anonymous block will be running in user mode as you explained at the start, which is respecting sharing context

  • @vikashchowdhary1670
    @vikashchowdhary1670 3 месяца назад +1

    - In apex anonymous block - the code runs in the user mode, i.e. With Sharing context.
    - Limitation of With Security_Enforced - it does not filter the results in where clause and it throws only the 1st error. Hence, apex always recommends With User_Mode.

  • @ravigrover1923
    @ravigrover1923 3 месяца назад +1

    The WITH SECURITY_ENFORCED clause in Apex has some limitations, including:
    Polymorphic lookup fields: This clause doesn't support traversing a polymorphic field's relationship in queries.
    Insufficient permissions: If a field is hidden, the query will throw an exception.
    DML operations: This clause can't be used in DML operations.

  • @mohd.arshad1315
    @mohd.arshad1315 3 месяца назад +1

    Yes, anonymous blocks in Salesforce can be executed in User Mode.

  • @ravigrover1923
    @ravigrover1923 3 месяца назад +1

    Yes permissionset can be assigned as shown below:
    PermissionSetAssignment psa = new PermissionSetAssignment
    (PermissionSetId = myPermissionSetId, AssigneeId = myAssigneeId);
    insert psa;

  • @dikshagautam7915
    @dikshagautam7915 2 месяца назад

    1.Anonymous block code by default executes in user Mode
    2. Limitations of With Security Enforced -
    -Applied security check only to fields and objects referenced in SELECT or FROM clauses(No WHERE clause)
    -Finds only First Error (Not all)
    3. Yes we can assign the permission set using apex .

  • @harmeetsandhu8238
    @harmeetsandhu8238 3 месяца назад +1

    1.anonymous Block will be running as USER_MODE
    2.WITH SECURITY_ENFORCED clause Enable If there are any fields or objects referenced in the SELECT clause that are inaccessible to the user, an exception is thrown and no data is returned.
    3.Yes , PermissionSetAssignment prset = new PermissionSetAssignment
    (PermissionSetId = myPermissionSetId, AssigneeId = myAssigneeId);
    insert prset;

  • @RoshChavan2328
    @RoshChavan2328 2 месяца назад

    If an inherited sharing class is the entry point and no explicit sharing context is defined, it will not default to with sharing. Instead, it will behave similarly to without sharing because there is no calling class to inherit the context from.
    Scenario 1: If MyEntryClass is called from another class, it will inherit the sharing context of the caller (either with sharing or without sharing).
    Scenario 2: If MyEntryClass is invoked directly, e.g., from a button click or a Visualforce page, there’s no sharing context to inherit, so it behaves as without sharing.
    If you want the class to enforce sharing rules by default when it is the entry point, you should explicitly declare it as with sharing instead of relying on inherited sharing.
    inherited sharing does not default to with sharing when the class is the entry point of the transaction.
    If you need sharing rules to be enforced by default, you should explicitly use with sharing.

  • @bbk9988
    @bbk9988 3 месяца назад

    Nice video with interview related stuff👌👍. Pls continue this series 😊
    Also explain these apex concepts and batch apex, security , triggers in detail through boot camps 😊

  • @vikashchowdhary1670
    @vikashchowdhary1670 3 месяца назад +1

    With System_Mode - For running apex in system mode

  • @mohd.arshad1315
    @mohd.arshad1315 3 месяца назад

    Ankit You are good, please make a list on the apex trigger and Aura also

  • @eswaratejaswi8778
    @eswaratejaswi8778 Месяц назад

    sir what is difference between a inhertied sharing calss and class with no sharing declaration(i.e a normal class)

  • @vikaskhose4700
    @vikaskhose4700 3 месяца назад +1

    Sir can you please make one Play list of apex like LWC please sir we request you

    • @harmeetsandhu8238
      @harmeetsandhu8238 3 месяца назад

      already have you can check on channel

    • @vikaskhose4700
      @vikaskhose4700 3 месяца назад

      @@harmeetsandhu8238 no for Apex there is no any playlist. Please check

    • @TechJourneyWithAnkit
      @TechJourneyWithAnkit  3 месяца назад

      Yes will plan for it

    • @vikaskhose4700
      @vikaskhose4700 3 месяца назад

      @@TechJourneyWithAnkit sir please do it as soon as possible. I Request you

  • @Smash9332
    @Smash9332 3 месяца назад

    Part 3 ?

  • @sareddysrikanthreddy-o8i
    @sareddysrikanthreddy-o8i 3 месяца назад

    in herited sharing little got confused

    • @TechJourneyWithAnkit
      @TechJourneyWithAnkit  3 месяца назад

      Checkout this link - developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_keywords_sharing.htm