Yes, using PermissionSetAssignment object, we can assign the permission set to user via apex
@ravigrover19236 ай бұрын
code written in anonymous block will be running in user mode as you explained at the start, which is respecting sharing context
@ravigrover19236 ай бұрын
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.
@vikashchowdhary16706 ай бұрын
- 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.
@ravigrover19236 ай бұрын
Yes permissionset can be assigned as shown below: PermissionSetAssignment psa = new PermissionSetAssignment (PermissionSetId = myPermissionSetId, AssigneeId = myAssigneeId); insert psa;
@mohd.arshad13156 ай бұрын
Yes, anonymous blocks in Salesforce can be executed in User Mode.
@harmeetsandhu82386 ай бұрын
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;
@dikshagautam79154 ай бұрын
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 .
@TechJourneyWithAnkit4 ай бұрын
All are correct Diksha
@RoshChavan23284 ай бұрын
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.
@TechJourneyWithAnkit4 ай бұрын
Correct my friend
@vikashchowdhary16706 ай бұрын
With System_Mode - For running apex in system mode
@bbk99886 ай бұрын
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 😊
@TechJourneyWithAnkit6 ай бұрын
Sure keep following !!
@eswaratejaswi87784 ай бұрын
sir what is difference between a inhertied sharing calss and class with no sharing declaration(i.e a normal class)
@TechJourneyWithAnkit3 ай бұрын
I cover that question in playlist
@mohd.arshad13156 ай бұрын
Ankit You are good, please make a list on the apex trigger and Aura also
@TechJourneyWithAnkit6 ай бұрын
Sure will plan for it
@vikaskhose47006 ай бұрын
Sir can you please make one Play list of apex like LWC please sir we request you
@harmeetsandhu82386 ай бұрын
already have you can check on channel
@vikaskhose47006 ай бұрын
@@harmeetsandhu8238 no for Apex there is no any playlist. Please check
@TechJourneyWithAnkit6 ай бұрын
Yes will plan for it
@vikaskhose47006 ай бұрын
@@TechJourneyWithAnkit sir please do it as soon as possible. I Request you
@Smash93326 ай бұрын
Part 3 ?
@TechJourneyWithAnkit6 ай бұрын
Will be on this Sunday !!
@sareddysrikanthreddy-o8i6 ай бұрын
in herited sharing little got confused
@TechJourneyWithAnkit6 ай бұрын
Checkout this link - developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_keywords_sharing.htm