function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
gowtham murugesangowtham murugesan 

Hi all,this is my code vf code and controller

Need to send "Generate Password and Notify user"  Link to user Email ,How to achive this,Kindly help me out

This is my code


<apex:page standardController="User" extensions="CreateNewUser" tabStyle="User">

    <apex:form >
        <apex:pageBlock mode="edit">
            <apex:pageMessages />
            <apex:pageBlockButtons >
                <apex:commandButton action="{!save}" value=" Save "></apex:commandButton>
                <apex:commandButton action="{!cancel}" value="Cancel"></apex:commandButton>
                
            </apex:pageBlockButtons>
            
            <apex:pageBlockSection title="User Information" columns="2" collapsible="false">  
                
                <apex:inputField value="{!User.FirstName}"/>
                <apex:inputField value="{!User.UserRoleId}"/>
                <apex:inputField value="{!User.LastName}"/>
                
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="License" for="lic"></apex:outputLabel>
                <apex:selectList id="mgr" value="{!User.Name}" size="1" title="Manager">
                    <apex:selectOptions value="{!license}"></apex:selectOptions>
                    <apex:actionSupport event="onchange" rerender="selectedProfileId"/>
                </apex:selectList>
                </apex:pageBlockSectionItem>
                <apex:inputField value="{!User.alias}"/>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Profile" for="pro"></apex:outputLabel>
                    <apex:selectList value="{!User.ProfileId}"  size="1" id="selectedProfileId" >
                    <apex:selectOptions value="{!profile}" />    
                    <apex:selectOptions value="{!profile1}" />
                    </apex:selectList>
                </apex:pageBlockSectionItem>
                <apex:inputField value="{!User.Email}"/>
                <apex:inputField value="{!User.IsActive}"/>
                <apex:inputField value="{!User.Username}"/>
            </apex:pageBlockSection>
            
            <apex:pageBlockSection >
                <apex:inputField value="{!User.CommunityNickName}"/>
                <apex:inputField value="{!User.Extension}"/>
                <apex:inputField value="{!User.Fax}"/>
                <apex:inputField value="{!User.EmployeeNumber}"/>
                <apex:inputField value="{!User.Title}"/>
                <apex:inputField value="{!User.CompanyName}"/>
                <apex:inputField value="{!User.Division}"/>
                <apex:inputField value="{!User.Department}"/>
                <apex:inputField value="{!User.Phone}"/>
                <apex:inputField value="{!User.ReceivesInfoEmails}" />
            </apex:pageBlockSection>
            
            <apex:pageBlockSection columns="1" showHeader="false" title="License">
            </apex:pageBlockSection> 
            <apex:pageBlockSection title="Other Information" columns="1" collapsible="false">
                <apex:inputField value="{!User.EmailEncodingKey}"/>
                <apex:inputField value="{!User.TimeZoneSidKey}"/> 
                <apex:inputField value="{!User.LocaleSidKey}"/>
                <apex:inputField value="{!User.LanguageLocaleKey}"/>
                 </apex:pageBlockSection>
                       
        </apex:pageBlock>
    </apex:form>
</apex:page>
==============
Controller:

public class CreateNewUser{

    
    public User user;
   
    public CreateNewUser(ApexPages.StandardController controller)
    { 
        this.user= (User)controller.getrecord();
        
    }

    
    
    public List<selectOption> getLicense()
    {
        List<selectOption> options = new List<selectOption>();
        options.add(new selectOption('', '- None -')); 
        for (UserLicense users :[SELECT Id,Name FROM UserLicense where Name = 'Partner Community' OR Name='Salesforce'])  
        {    
            options.add(new selectOption(users.Id, users.Name));
            
        }
        return options; 
    }
    
    public List<selectOption> getProfile() {
        List<selectOption> options1 = new List<selectOption>(); 
        options1.add(new selectOption('', '- None -'));
        for (Profile users1 :[SELECT Id,Name FROM Profile where Usertype = 'PowerPartner'])  { 
            options1.add(new selectOption(users1.Id, users1.Name)); 
        } 
        return options1;
    }
}