Set User Password Using Apex in Salesforce
Sample Code:
//Get User User u = [SELECT Id From User Where Username = 'test@testuser.com']; //Set Password system.setPassword(u.Id, 'Pass@1234');
Sample Code:
//Get User User u = [SELECT Id From User Where Username = 'test@testuser.com']; //Set Password system.setPassword(u.Id, 'Pass@1234');
Sample Code:
<apex:pageBlockSectionItem> <apex:outputLabel value="Group" for="groupSelectList"/> <apex:outputPanel styleClass="requiredInput" layout="block"> <apex:outputPanel styleClass="requiredBlock" layout="block"/> <apex:selectList value="{!selectedGroup}" id="groupSelectList" size="1" required="true"> <apex:selectOptions value="{!groupOptions}"/> </apex:selectList> </apex:outputPanel> </apex:pageBlockSectionItem>
Sample Code:
String soqlQuery = 'Select Id, Name From Account'; Map <Id, Account> accountMap = new Map<Id, Account>( (List<Account>)Database.query(soqlQuery) ); System.debug('AccountMap-' + accountMap);
We use @InvocableMethod
annotation, whenever we want to invoke an apex method from the Process Builder then that method must be declared as @InvocableMethod
, otherwise it can’t be accessed in Process Builder.
Invocable Annotation Method Example:
public class AccountAction { @InvocableMethod(label='Update Account' description='Update the list of accounts to the specified account IDs.') public static void updateAccounts(List<Id> ids) { } }
Use Cases of Invocable Method:
static
and public
or global
, and its class must be an outer class.InvocableMethod
annotation.InvocableMethod
annotation.Inputs and Outputs of Invocable Method:
There can be at most one input parameter and its data type must be one of the following:
Invocable Methods in Managed Packages:
InvocableMethod
in packages, but once we add an Invocable method, we can’t remove it from later versions of the package.Sample Code:
Integer numberofFields = Account.sObjectType.getDescribe().fields.getMap().size(); system.debug('Number of Fields-'+ numberofFields);