How to avoid updating certain field values in Salesforce using trigger?
In the below example, if the account type is Customer - Direct and if the user tries to update any fields other than Industry and Description, it will throw an ....
In the below example, if the account type is Customer - Direct and if the user tries to update any fields other than Industry and Description, it will throw an ....
If any fields or objects referenced in the SOQL SELECT query using WITH SECURITY_ENFORCED are inaccessible to the user, an exception is thrown, and no data is returned. Use the ....
OrgLimit ClassThe System.OrgLimit class contains methods that return the name, current value, and maximum limit for an instance. getName() - Returns the limit’s name.getValue() - Returns the limit usage value.getLimit() ....
Run the below code in Anonymous window. Sample Code: for ( OrgLimit o : OrgLimits.getAll() ) { system.debug( o.getName() + ' - ' + o.getValue() + ' - ' + ....
Sample Code: Apex Class: public with sharing class AccountController { @AuraEnabled( cacheable = true ) public static List< Account > fetchAccounts( String searchKey ) { String strKey = '%' + ....
Note: 1. Enter API Name of the child object in Object Name. 2. Parent Field API Name should be the lookup or master-detail field API Name. 3. Filed Name is ....
Database.delete() can be used to delete records across multiple objects using Apex in Salesforce. Sample Code: List < Id > toDeleteIds = new List < Id > { '0WO2M000000mbwnWAA', '5002M00000mnEdCQAU', ....
Use the following method from the sample code to create an user with unique username in test class in Salesforce. Sample Code: public static User createTestempUser( Id roleId, Id profID, ....
Sample Code: Set < String > listsObjs = new Set < String > {'Account', 'Lead'}; Map<String, Schema.SObjectType > globalDescription = Schema.getGlobalDescribe(); for ( String obj : listsObjs ) { Schema.sObjectType objType = globalDescription.get( obj ); Schema.DescribeSObjectResult r1 = objType.getDescribe(); Map<String , Schema.SObjectField > mapFieldList = r1.fields.getMap(); for ( Schema.SObjectField field : mapFieldList.values() ) { Schema.DescribeFieldResult fieldResult = field.getDescribe(); String fieldLabel = fieldResult.getLabel().toLowerCase(); Schema.DisplayType fielddataType = fieldResult.getType(); if ( ( fieldLabel.contains( 'address' ) || fieldLabel.contains( 'state' ) || fieldLabel.contains( 'street' ) || fieldLabel.contains( 'city' ) || fieldLabel.contains( 'postal' ) || fieldLabel.contains( 'zip' ) ) && ! fieldResult.isCalculated() ) { System.debug ( objType + '.' + fieldResult.getName() ); } } } In ....
1. Execute the below code in Developer Console. for ( Profile objProfile : [ SELECT Name, ( SELECT Id, IsActive FROM Users ) FROM Profile ORDER BY Name ] ) ....