• B Tulasi
  • NEWBIE
  • 130 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 34
    Questions
  • 44
    Replies
Hi All,

Merge Statements in trigger :
1 > What is Merge Statement ?
2 > Why use this merge statement?
3 > When use this merge statement?
Give me one example.
Allready i searched in google. But i am not getting about the winning record and losing record.
can any one explain ?

Thanks in advance
Thulasi
Hi All,

How to write test class for Registration Page

Apex class :

public class RegistrationExtention {
    public Registration__c reg { get; set;}
    //set<id> s=new set<id>
    public RegistrationExtention(ApexPages.StandardController controller) {
        reg=new Registration__c();
    }
        public PageReference dosave(){       
       
            if  (reg.Name==null || reg.Name.length()==0){
                //reg.Name.addError('Last Name will not be blank');
                ApexPages.addMessage(new ApexPages.Message(ApexPages.severity.INFO, 'Last Name will not be blank'));
                return null;
            }
            else if (reg.Mail_Id__c==null || reg.Mail_Id__c.length()==0){
                //reg.Mail_Id__c.addError('Email will not be blank');
                ApexPages.addMessage(new ApexPages.Message(ApexPages.severity.INFO, 'Email will not be blank'));
                return null;
            }
       
            else if(reg.User_Name__c==null|| reg.User_Name__c.length()==0){
                //reg.User_Name__c.addError('UserwName will not be blank');
                ApexPages.addMessage(new ApexPages.Message(ApexPages.severity.INFO, 'UserName will not be blank'));
                return null;
            }
            else if(reg.Password__c == null || reg.Password__c.length()==0) {
                //reg.Password__c.addError('Password will not be blank');
                ApexPages.addMessage(new ApexPages.Message(ApexPages.severity.INFO, 'Password will not be blank'));
                return null;            
            }
            else if(reg.Confirm_Password__c == null || reg.Confirm_Password__c.length()==0) {
                //reg.Confirm_Password__c.addError('Confirm Password will not be blank');
                ApexPages.addMessage(new ApexPages.Message(ApexPages.severity.INFO, 'Confirm Password will not be blank'));
                return null;            
            }                
                
            else{   
        insert reg;
        PageReference pr=new PageReference ('/apex/loginpage');
        pr.setredirect(true);
        return pr;
        }
        }  

}


Test Class :

@isTest
public class RegistrationExtentionTest{
    public static testMethod void regpage(){
ApexPages.Message[] pageMessages = ApexPages.getMessages();

    
    Registration__c reg1=new Registration__c();
       ApexPages.StandardController controller=new ApexPages.StandardController(reg1);
        RegistrationExtention re=new RegistrationExtention(controller);
        re.reg.Name='';
        re.reg.Mail_Id__c='';
        re.reg.User_Name__c='';
        re.reg.Password__c='';
        re.reg.Confirm_Password__c='';    
        
        
        re.dosave();

    }   

}

It's covering only 7 lines out of 23. How to cover the if ,  else if statements and need to cover insert operation too.

Thanks in advance
Tulasi
Hi All,
 How to write a test class for apex error message in Apex class.

 
Apex Class :


else if (reg.Mail_Id__c==null || reg.Mail_Id__c.length()==0){              
                  ApexPages.addMessage(new ApexPages.Message(ApexPages.severity.INFO, 'Email will not be blank'));                
                 return null;             


Test Class :

Registration__c reg1=new Registration__c();
       ApexPages.StandardController controller=new ApexPages.StandardController(reg1);
        RegistrationExtention re=new RegistrationExtention(controller);
        re.reg.Name='something';
        re.reg.Mail_Id__c='abc@gmail.com';
        re.reg.User_Name__c='something';
        re.reg.Password__c='something';
        re.reg.Confirm_Password__c='something';  
        PageReference pageRef = Page.RegistrationPage;
        Test.setCurrentPage(pageRef);
        
        ApexPages.currentPage().getParameters();
        String id = ApexPages.currentPage().getParameters().get('id');
        system.assertEquals(true,id!=null);
        re.dosave();
       

thanks in advance
Thulasi
Hi All,

I am trying to create mandatory field through controller. But, I am not getting any output.
Bellow is my code. I want User_Name__C and Password__C as required fields.

VF Page :

<apex:page standardController="Registration__c" extensions="RegistrationExtention" >
<script>
function mySubmit(){
    var sub=confirm("Are you Sure, You want to submit the data");
    if(sub==true){
        return true;
    }
    else{
    return false;
    }

}


</script>
<style>

</style>

<apex:form id="frm" >
   
<apex:pageBlock id="pb">
<div  style="height:400px;">

<table bgcolor="#CEF6E3" align="center" style=" width:100%; height:400px; font-size:15px;  "   >
<center>
    
     <tr >
     <td>
     <tr>
     <td>
     <tr>
     <td >     
            <apex:outputLabel style="margin-left:410px;" >Last Name</apex:outputLabel>
         <td>
            
            <apex:inputField value="{!reg.Name}"  style="margin-left:-400px;"   />    
        </td>

    </td>
    </tr>
    </td>
    </tr>
    </td>
    </tr>
   
 <tr>
     <td>
    <apex:outputLabel style="margin-left:315px; padding:10%">First Name</apex:outputLabel>
    </td><td>
    
    <apex:inputField value="{!reg.First_Name__c}" style="margin-left:-400px;"/>
     
  </td>
    </tr>
 <tr>
     <td>  
    <apex:outputLabel style="margin-left:315px; padding:10%" >Gender</apex:outputLabel>
    </td><td>
    
    <apex:inputField value="{!reg.Gender__c}" style="margin-left:-400px;" / >
    
  </td>
    </tr>
 <tr>
     <td>
    <apex:outputLabel style="margin-left:315px; padding:10%">EMail</apex:outputLabel>
    </td><td>
    <apex:inputField value="{!reg.Mail_Id__c}" style="margin-left:-400px;"/>
  </td>
    </tr>
 <tr>
     <td>
    <apex:outputLabel style="margin-left:315px; padding:10%">Phone </apex:outputLabel>
    </td><td>
    <apex:inputField value="{!reg.Phone__c}" style="margin-left:-400px;"/>
  </td>
    </tr>
 <tr>
     <td>
    <apex:outputLabel style="margin-left:315px; padding:10%">DateOfBirth </apex:outputLabel>
    </td><td>
    <apex:inputField value="{!reg.Date_of_Birth__c}" style="margin-left:-400px;"/>
  </td>
    </tr>
 <tr>
     <td>
    <apex:outputLabel style="margin-left:315px; padding:10%">Username </apex:outputLabel>
    </td><td>
    <apex:inputField value="{!reg.User_Name__c}" style="margin-left:-400px;"/>
  </td>
    </tr>
 <tr>
     <td>
    <apex:outputLabel style="margin-left:315px; padding:10%">Password</apex:outputLabel>
    </td><td>
    <apex:inputField value="{!reg.Password__c}" style="margin-left:-400px;"/>
  </td>
    </tr>
 <tr>
     <td>
    <apex:outputLabel style="margin-left:315px; padding:8%" > Confirm Password <sup Style="color:Red;font-size:15px">*</sup> </apex:outputLabel>
    </td><td>
    <apex:inputField value="{!reg.Confirm_Password__c}" style="margin-left:-400px;"/>
  </td>
    </tr>
 <tr>
     <td>
    <apex:commandButton style="margin-left:500px" value="Submit" action="{!dosave}" onclick="{return mySubmit();}" reRender="Error" />
    
    </td><td>
    <apex:outputLink value="https://c.ap2.visual.force.com/apex/loginpage"  >Sign In</apex:outputLink>
    <apex:pageMessages id="Error"></apex:pageMessages>
    
    </td>
</tr>
</center>
</table>

</div>
</apex:pageBlock>
</apex:form>
</apex:page>


Controller :

public class RegistrationExtention {
    public Registration__c reg { get; set;}
    public RegistrationExtention(ApexPages.StandardController controller) {
        reg=new Registration__c();
    }
        public PageReference dosave(){
        Registration__c reg1=new Registration__c();
        
        reg1.Name=reg.Name;        
        reg1.First_Name__c=reg.First_Name__c;
        reg1.Gender__c=reg.Gender__c;
        reg1.Mail_Id__c=reg.Mail_Id__c;
        reg1.Phone__c=reg.Phone__c;
        reg1.Date_of_Birth__c=reg.Date_of_Birth__c;
        reg1.User_Name__c=reg.User_Name__c;
        reg1.Password__c=reg.Password__c;
        reg1.Confirm_Password__c=reg.Confirm_Password__c;    
        if(reg1.User_Name__c==null || reg1.User_Name__c==''){           
            reg.User_Name__c.addError('It is required Field');
            //ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.FATAL, 'Name is required.'));
            return null;
        }else{
            insert reg1;
        
        PageReference pr=new PageReference ('/apex/loginpage');
        pr.setredirect(true);
        return pr;
        }
        }

}

Please , help me where i did mistake

thanks in Advance
Thulasi
Hi All,

 I need Required input field in visual force. I given as Required = "true".
    <apex:inputField value="{!reg.Confirm_Password__c}" style="margin-left:-400px;" required="true"/>

It's working. But i don't want " | " this symbol as red mark. I want Star symbol as red color. Here, i am using <sup Style="color:Red">*</sup> tag for Star symbol. How to hide the " | " symbol.

Thanks in advance
Thulasi
Hi All,

I am trying give a link one VF Page to another VF Page.

 login = [select ID, Name, User_Name__c, Password__c from Registration__c Where User_Name__c=:userName and Password__c=:password];
        if(!login.isEmpty()) {
            Pagereference pr = new PageReference('/apex/timesheet'+login[0].id);  // here Timesheet is another visualforce page
            pr.setReDirect(true);
            return pr;
        }

Error : page timesheeta0928000005arw8aaa does not exist

Thanks in advance
Thulasi.

 
I want to get popup box for custom button in VF PageHi All,

What is the difference between Controller and Extension ?

I want to get popup box for custom button in VF Page. I searched in google, it is saying like popup code should be write in Extension controller. Can we write code in controller for dispaly the pupup box ?

Thanks in Advance
Thulasi
Hi All,

I have one custome field i.e. Time__C. I need to count time from different records within the object. what we counted time will be store in another custom field i.e Toatal_Time__C.
For Example :
Record1 : Time__C=2 hours.
Record2 : Time__C=3 hours.
Record3 : Time__C=2 hours.

So, Total_Time=7 Hours.

Trigger :

trigger TimeCount on Work_Log_Sheet__c (before insert, before update) {
    decimal count;
    Set<Id> sid = new Set<Id>();
    List<Work_Log_Sheet__c> lwls=New List<Work_Log_Sheet__c>();
    for (Work_Log_Sheet__c wls : lwls) {
        sid.add(wls.Id);       
    
        if(wls.Work_Update_Date__c==System.today()){
            wls.Total_Hours__c=wls.Total_Hours__c+wls.Total_Time__c;            
            lwls.add(wls);
        }
    }
   insert lwls;
      
}

Note : there is no error . but i am not getting results.  How can i write this code.

Thanks in advance
Thulasi.
Hi All,

I have one custome field i.e. Time__C. I need to count time from different records within the object. what we counted time will be store in another custom field i.e Toatal_Time__C.
For Example :
Record1 : Time__C=2 hours.
Record2 : Time__C=3 hours.
Record3 : Time__C=2 hours.

So, Total_Time=7 Hours.

Thanks in advance
Thulasi.
Hi All,

I need to insert current date into the date field. Here i am using trigger for that. But, it is not inserting the current date.
Plead check my code and what is the problem in that.
Bellow my code.

Code :

trigger Tmesheet on Work_Log_Sheet__c (before insert, after insert) {

    list<Work_Log_Sheet__c > lwls = new list<Work_Log_Sheet__c> ();
      for(Work_Log_Sheet__c wls : trigger.new){
        wls.Work_Update_Date__c=system.today();
        lwls.add(wls);        
        insert lwls;   
        }     
}

Error :

Tmesheet: execution of BeforeInsert caused by: System.SObjectException: DML statement cannot operate on trigger.new or trigger.old: Trigger.Tmesheet: line 7, column 1


Thanks in advance
Thulasi
Hi All,

       I am getting page is blank, while click the login button.I didn't get any error before saving the code. While loging the page, it will be blank page

VF CODE :

<apex:page controller="Sample" sidebar="false" >
<apex:form >
<apex:pageBlock >

    <br>UserName&nbsp;<apex:inputText label="center" value="{!userName}"/></br>
    <br>Password &nbsp;&nbsp;<apex:inputsecret value="{!password}"/></br>    
    <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <apex:commandButton value="Login" action="{!loginPage}" reRender="Error"/></br>
    <br><br>
    <apex:outputLink value="https://c.ap2.visual.force.com/apex/RegistrationPage">Create New Account</apex:outputLink>
    </br></br>
    <apex:pageMessages id="Error"></apex:pageMessages>
    
</apex:pageBlock>
</apex:form>
</apex:page>





Controller :

public class Sample {     
    public String userName{get;set;}
    public String password{get;set;}
    public List<Registration__c> returns {get;set;}
   
    public Sample(){
   
      returns = new List<Registration__c>();
    }  
   
    public PageReference loginPage(){
   
        returns = [select ID, Name, User_Name__c, Password__c from Registration__c Where User_Name__c=:userName and Password__c=:password];
        if(!returns.isEmpty()) {
            Pagereference pr = new PageReference('/'+returns[0].id);
            pr.setReDirect(false);
            return pr;
        }
        else {
                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,'Invalid UserName or Password'));
                return null;
        }
        //Pagereference pr = new PageReference('/'+returns[0].Id);
        //pr.setRedirect(true);
        //return pr;
        return null;
    }

}

Plead Identify the error, what is missing here.

Thanks in advance
Thulasi
 
Hi All,

       I am getting confused to get notification in salesforce. Actually  My requrement is,  while loging out my salesforce login, Half an hour back i need to send mail to higher authority. so, that notification is just knowing purpose means alert message like that. How to get notification. If i get notification, where i can view that.
Note : It is possible or not to get notification in salesforce.


Thanks in advance
Thulasi
Hi All,

         How to send two Emails at a time from inputtext field. Actually now am sending only one mail like thulasi.204@gmail.com.
But My requirement is, I need to send one or more mails at time. like thulasi.204@gmail.com,abcd@gmail.com. So, how to send two mail at time.
My code :
public class sendemailcontroller {
    public String to { get; set; }
    public PageReference sendmail() {
    
    Messaging.SingleEmailMessage mail=new Messaging.SingleEmailMessage();
    list<String> mid=(new String[]{to});
    mid.add(to);   
 
    mail.setToAddresses(mid);
    mail.setSubject('mail Sent Successfulluy');
    
    mail.setPlainTextBody('your case has been created');
    mail.setHtmlBody( 'I am not getting this sentence '+ 'here some link is there');
    Messaging.sendEmail(new Messaging.SingleEmailMessage[]{mail});
        return null;
    }

}


Thanks in Advance
Thulasi
Hi All,

I am trying to create One LoginPage using Visualforce Page. But, I am getting error in this. 

Requirement :

1 > Username is corrct and Password is correct
    It needs to login the page
2 > Username is Wrong and Password is correct
    Error : Plz Enter Valid Username
3 > Username is correct and Password is wrong
    Error : Plz Enter Valid Password
4 > Username is wrong and Password is wrong
    Error : Plz Enter Valid Username and Password.

I am getting unexpected Results. 


VF Code :

<apex:page controller="Sample">
<apex:form >
<apex:pageBlock >

    <br>UserName&nbsp;<apex:inputText label="center" value="{!userName}"/></br>
    <br>Password &nbsp;&nbsp;<apex:inputsecret value="{!password}"/></br>
    <apex:commandButton value="Login" action="{!loginPage}" reRender="Error"/>
    
    <apex:pageMessages id="Error"></apex:pageMessages> 
    
</apex:pageBlock>
</apex:form>
</apex:page>


My code : 


public class Sample {      
    public String userName{get;set;}
    public String password{get;set;}
    public List<Account> returns {get;set;}
    public Sample(){
        returns =new List<Account>();
    }
    public PageReference loginPage(){
        
        Account acc=new Account();
       returns = [select ID, Name, Sic from Account Where Name=:userName and sic=:password];
        if(userName == acc.Name && Password == acc.Sic){
            Pagereference pr = new PageReference('/'+returns[0].Id);
            pr.setReDirect(true);
            return pr;
        }
        
        else if (userName != acc.Name && Password == acc.Sic){
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,'Plz Enter valid UserName'));
            return null;

        }
        else if ( userName == acc.Name  && Password != acc.Sic){
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,'Plz Enter Valid Password'));
            return null;
        }
        
        else {
                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,'Invalid UserName or Password'));
                return null;
        }
        
    }

}


Thanks in Advance 
Thulasi
Hi All,

I am getting error in this . How to write test class for Login Page.

VisualForce Page Code: 
<apex:page controller="Sample">
<apex:form >
<apex:pageBlock >

    <br>UserName&nbsp;<apex:inputText label="center" value="{!userName}"/></br>
    <br>Password &nbsp;&nbsp;<apex:inputsecret value="{!password}"/></br>
    <apex:commandButton value="Login" action="{!loginPage}" reRender="Error"/>
    
    <apex:pageMessages id="Error"></apex:pageMessages> 
    
</apex:pageBlock>
</apex:form>
</apex:page>

Apex Class Code :

public class Sample {      
    public String userName{get;set;}
    public String password{get;set;}
    public List<Account> returns {get;set;}
    
    public Sample(){
    
      returns = new List<Account>();
    }    
    
    public PageReference loginPage(){
    
        returns = [select ID, Name, Sic from Account Where Name=:userName and sic=:password];
        if(!returns.isEmpty()) {
            Pagereference pr = new PageReference('/'+returns[0].Id);
            pr.setReDirect(true);
            return pr;
        }
        else {
                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,'Invalid UserName or Password'));
                return null;
        }
        //Pagereference pr = new PageReference('/'+returns[0].Id);
        //pr.setRedirect(true);
        //return pr;
    }

}






Test Class Code :

@isTest
public class SampleTest{
    public static testMethod void loginPageTestMethod(){
        Sample s=new Sample();
        Account acc=new Account(Name='Kokila');
        insert acc;
        s.loginPage();          
        System.assertEquals(s.pr,'Kokila');
        
    }
}



Thanks in advance
Thulasi
Hi All,

I have to give PPT for SOSL. So, give me some information for that. Plz Don't give google page links. What u have an idea on SOSL, that's enough. I mean What mainly used in organization that topics.

Thanks in advance
Thulasi
Hi All,


1 > What is anonymous Blocks in salesforce
2 > List> searchList = [FIND 'map*' IN ALL FIELDS RETURNING Account (id, name),Contact, Opportunity, Lead];
       in the second line, What is the meaning of map in that query.


. plz give me some simple sentences

Thanks in advance
Thulasi
Hi All,

I have to give one presentation for SOSL. So, plz provide information for that.
What is SOSL  and what is use of this and syntax and with example. difference between soql and sosl

Thanks in advance
Thulasi.
Hi All,

How to write Test Class for Prime Numbers. I given code in bellow.

Code : public class PrimeNumbers {
    public void prime(){
    for(integer i=1;i<=100;i++)
    {
        integer count=0;
        for(integer j=i; j>=1;j--)
        {
            
            if(math.mod(i,j)==0 )
            {
                count++;
            }
        }
        if(count==2 || count==1){
            
                         system.debug(i);
                   
                }                     
                 
            else{
               //system.debug('not prime');      
                }
    }
  }

}


Thanks in advance
Thulasi
Hi Guys,

Tell Me, What are the Security and Sharing concepts. I want list of security and sharing concepts.


Thanks in advance
Thulasi
I am surprised to see this behaviour .I am updating billingCountry and billingpostalcode of Account.In trigger.new i am recieving billingpostalcode new value but not same case with billingcountry.
codesnippet:
trigger AccountTrigger on Account (before insert ,before update,after insert,after update) {
   if(trigger.isBefore){
       for(account accnt:trigger.new){
            system.debug('testing'+accnt.BillingCountry+accnt.BillingPostalCode);           
        } 
   } 
}

am i only the one who is facing this?
Hi All,

Merge Statements in trigger :
1 > What is Merge Statement ?
2 > Why use this merge statement?
3 > When use this merge statement?
Give me one example.
Allready i searched in google. But i am not getting about the winning record and losing record.
can any one explain ?

Thanks in advance
Thulasi
Hi All,
 How to write a test class for apex error message in Apex class.

 
Apex Class :


else if (reg.Mail_Id__c==null || reg.Mail_Id__c.length()==0){              
                  ApexPages.addMessage(new ApexPages.Message(ApexPages.severity.INFO, 'Email will not be blank'));                
                 return null;             


Test Class :

Registration__c reg1=new Registration__c();
       ApexPages.StandardController controller=new ApexPages.StandardController(reg1);
        RegistrationExtention re=new RegistrationExtention(controller);
        re.reg.Name='something';
        re.reg.Mail_Id__c='abc@gmail.com';
        re.reg.User_Name__c='something';
        re.reg.Password__c='something';
        re.reg.Confirm_Password__c='something';  
        PageReference pageRef = Page.RegistrationPage;
        Test.setCurrentPage(pageRef);
        
        ApexPages.currentPage().getParameters();
        String id = ApexPages.currentPage().getParameters().get('id');
        system.assertEquals(true,id!=null);
        re.dosave();
       

thanks in advance
Thulasi
Hi All,

I am trying to create mandatory field through controller. But, I am not getting any output.
Bellow is my code. I want User_Name__C and Password__C as required fields.

VF Page :

<apex:page standardController="Registration__c" extensions="RegistrationExtention" >
<script>
function mySubmit(){
    var sub=confirm("Are you Sure, You want to submit the data");
    if(sub==true){
        return true;
    }
    else{
    return false;
    }

}


</script>
<style>

</style>

<apex:form id="frm" >
   
<apex:pageBlock id="pb">
<div  style="height:400px;">

<table bgcolor="#CEF6E3" align="center" style=" width:100%; height:400px; font-size:15px;  "   >
<center>
    
     <tr >
     <td>
     <tr>
     <td>
     <tr>
     <td >     
            <apex:outputLabel style="margin-left:410px;" >Last Name</apex:outputLabel>
         <td>
            
            <apex:inputField value="{!reg.Name}"  style="margin-left:-400px;"   />    
        </td>

    </td>
    </tr>
    </td>
    </tr>
    </td>
    </tr>
   
 <tr>
     <td>
    <apex:outputLabel style="margin-left:315px; padding:10%">First Name</apex:outputLabel>
    </td><td>
    
    <apex:inputField value="{!reg.First_Name__c}" style="margin-left:-400px;"/>
     
  </td>
    </tr>
 <tr>
     <td>  
    <apex:outputLabel style="margin-left:315px; padding:10%" >Gender</apex:outputLabel>
    </td><td>
    
    <apex:inputField value="{!reg.Gender__c}" style="margin-left:-400px;" / >
    
  </td>
    </tr>
 <tr>
     <td>
    <apex:outputLabel style="margin-left:315px; padding:10%">EMail</apex:outputLabel>
    </td><td>
    <apex:inputField value="{!reg.Mail_Id__c}" style="margin-left:-400px;"/>
  </td>
    </tr>
 <tr>
     <td>
    <apex:outputLabel style="margin-left:315px; padding:10%">Phone </apex:outputLabel>
    </td><td>
    <apex:inputField value="{!reg.Phone__c}" style="margin-left:-400px;"/>
  </td>
    </tr>
 <tr>
     <td>
    <apex:outputLabel style="margin-left:315px; padding:10%">DateOfBirth </apex:outputLabel>
    </td><td>
    <apex:inputField value="{!reg.Date_of_Birth__c}" style="margin-left:-400px;"/>
  </td>
    </tr>
 <tr>
     <td>
    <apex:outputLabel style="margin-left:315px; padding:10%">Username </apex:outputLabel>
    </td><td>
    <apex:inputField value="{!reg.User_Name__c}" style="margin-left:-400px;"/>
  </td>
    </tr>
 <tr>
     <td>
    <apex:outputLabel style="margin-left:315px; padding:10%">Password</apex:outputLabel>
    </td><td>
    <apex:inputField value="{!reg.Password__c}" style="margin-left:-400px;"/>
  </td>
    </tr>
 <tr>
     <td>
    <apex:outputLabel style="margin-left:315px; padding:8%" > Confirm Password <sup Style="color:Red;font-size:15px">*</sup> </apex:outputLabel>
    </td><td>
    <apex:inputField value="{!reg.Confirm_Password__c}" style="margin-left:-400px;"/>
  </td>
    </tr>
 <tr>
     <td>
    <apex:commandButton style="margin-left:500px" value="Submit" action="{!dosave}" onclick="{return mySubmit();}" reRender="Error" />
    
    </td><td>
    <apex:outputLink value="https://c.ap2.visual.force.com/apex/loginpage"  >Sign In</apex:outputLink>
    <apex:pageMessages id="Error"></apex:pageMessages>
    
    </td>
</tr>
</center>
</table>

</div>
</apex:pageBlock>
</apex:form>
</apex:page>


Controller :

public class RegistrationExtention {
    public Registration__c reg { get; set;}
    public RegistrationExtention(ApexPages.StandardController controller) {
        reg=new Registration__c();
    }
        public PageReference dosave(){
        Registration__c reg1=new Registration__c();
        
        reg1.Name=reg.Name;        
        reg1.First_Name__c=reg.First_Name__c;
        reg1.Gender__c=reg.Gender__c;
        reg1.Mail_Id__c=reg.Mail_Id__c;
        reg1.Phone__c=reg.Phone__c;
        reg1.Date_of_Birth__c=reg.Date_of_Birth__c;
        reg1.User_Name__c=reg.User_Name__c;
        reg1.Password__c=reg.Password__c;
        reg1.Confirm_Password__c=reg.Confirm_Password__c;    
        if(reg1.User_Name__c==null || reg1.User_Name__c==''){           
            reg.User_Name__c.addError('It is required Field');
            //ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.FATAL, 'Name is required.'));
            return null;
        }else{
            insert reg1;
        
        PageReference pr=new PageReference ('/apex/loginpage');
        pr.setredirect(true);
        return pr;
        }
        }

}

Please , help me where i did mistake

thanks in Advance
Thulasi
Hi All,

 I need Required input field in visual force. I given as Required = "true".
    <apex:inputField value="{!reg.Confirm_Password__c}" style="margin-left:-400px;" required="true"/>

It's working. But i don't want " | " this symbol as red mark. I want Star symbol as red color. Here, i am using <sup Style="color:Red">*</sup> tag for Star symbol. How to hide the " | " symbol.

Thanks in advance
Thulasi
Hi All,

I am trying give a link one VF Page to another VF Page.

 login = [select ID, Name, User_Name__c, Password__c from Registration__c Where User_Name__c=:userName and Password__c=:password];
        if(!login.isEmpty()) {
            Pagereference pr = new PageReference('/apex/timesheet'+login[0].id);  // here Timesheet is another visualforce page
            pr.setReDirect(true);
            return pr;
        }

Error : page timesheeta0928000005arw8aaa does not exist

Thanks in advance
Thulasi.

 
Hi All,

I have one custome field i.e. Time__C. I need to count time from different records within the object. what we counted time will be store in another custom field i.e Toatal_Time__C.
For Example :
Record1 : Time__C=2 hours.
Record2 : Time__C=3 hours.
Record3 : Time__C=2 hours.

So, Total_Time=7 Hours.

Trigger :

trigger TimeCount on Work_Log_Sheet__c (before insert, before update) {
    decimal count;
    Set<Id> sid = new Set<Id>();
    List<Work_Log_Sheet__c> lwls=New List<Work_Log_Sheet__c>();
    for (Work_Log_Sheet__c wls : lwls) {
        sid.add(wls.Id);       
    
        if(wls.Work_Update_Date__c==System.today()){
            wls.Total_Hours__c=wls.Total_Hours__c+wls.Total_Time__c;            
            lwls.add(wls);
        }
    }
   insert lwls;
      
}

Note : there is no error . but i am not getting results.  How can i write this code.

Thanks in advance
Thulasi.
Hi All,

I have one custome field i.e. Time__C. I need to count time from different records within the object. what we counted time will be store in another custom field i.e Toatal_Time__C.
For Example :
Record1 : Time__C=2 hours.
Record2 : Time__C=3 hours.
Record3 : Time__C=2 hours.

So, Total_Time=7 Hours.

Thanks in advance
Thulasi.
Hi every body,

I want to write a Trigger to send email to Manager, when the new project is created. So, how can i write it?
Hi All,

I need to insert current date into the date field. Here i am using trigger for that. But, it is not inserting the current date.
Plead check my code and what is the problem in that.
Bellow my code.

Code :

trigger Tmesheet on Work_Log_Sheet__c (before insert, after insert) {

    list<Work_Log_Sheet__c > lwls = new list<Work_Log_Sheet__c> ();
      for(Work_Log_Sheet__c wls : trigger.new){
        wls.Work_Update_Date__c=system.today();
        lwls.add(wls);        
        insert lwls;   
        }     
}

Error :

Tmesheet: execution of BeforeInsert caused by: System.SObjectException: DML statement cannot operate on trigger.new or trigger.old: Trigger.Tmesheet: line 7, column 1


Thanks in advance
Thulasi
Hi All,

       I am getting page is blank, while click the login button.I didn't get any error before saving the code. While loging the page, it will be blank page

VF CODE :

<apex:page controller="Sample" sidebar="false" >
<apex:form >
<apex:pageBlock >

    <br>UserName&nbsp;<apex:inputText label="center" value="{!userName}"/></br>
    <br>Password &nbsp;&nbsp;<apex:inputsecret value="{!password}"/></br>    
    <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <apex:commandButton value="Login" action="{!loginPage}" reRender="Error"/></br>
    <br><br>
    <apex:outputLink value="https://c.ap2.visual.force.com/apex/RegistrationPage">Create New Account</apex:outputLink>
    </br></br>
    <apex:pageMessages id="Error"></apex:pageMessages>
    
</apex:pageBlock>
</apex:form>
</apex:page>





Controller :

public class Sample {     
    public String userName{get;set;}
    public String password{get;set;}
    public List<Registration__c> returns {get;set;}
   
    public Sample(){
   
      returns = new List<Registration__c>();
    }  
   
    public PageReference loginPage(){
   
        returns = [select ID, Name, User_Name__c, Password__c from Registration__c Where User_Name__c=:userName and Password__c=:password];
        if(!returns.isEmpty()) {
            Pagereference pr = new PageReference('/'+returns[0].id);
            pr.setReDirect(false);
            return pr;
        }
        else {
                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,'Invalid UserName or Password'));
                return null;
        }
        //Pagereference pr = new PageReference('/'+returns[0].Id);
        //pr.setRedirect(true);
        //return pr;
        return null;
    }

}

Plead Identify the error, what is missing here.

Thanks in advance
Thulasi
 
Hi All,

         How to send two Emails at a time from inputtext field. Actually now am sending only one mail like thulasi.204@gmail.com.
But My requirement is, I need to send one or more mails at time. like thulasi.204@gmail.com,abcd@gmail.com. So, how to send two mail at time.
My code :
public class sendemailcontroller {
    public String to { get; set; }
    public PageReference sendmail() {
    
    Messaging.SingleEmailMessage mail=new Messaging.SingleEmailMessage();
    list<String> mid=(new String[]{to});
    mid.add(to);   
 
    mail.setToAddresses(mid);
    mail.setSubject('mail Sent Successfulluy');
    
    mail.setPlainTextBody('your case has been created');
    mail.setHtmlBody( 'I am not getting this sentence '+ 'here some link is there');
    Messaging.sendEmail(new Messaging.SingleEmailMessage[]{mail});
        return null;
    }

}


Thanks in Advance
Thulasi
Hi All,

I am getting error in this . How to write test class for Login Page.

VisualForce Page Code: 
<apex:page controller="Sample">
<apex:form >
<apex:pageBlock >

    <br>UserName&nbsp;<apex:inputText label="center" value="{!userName}"/></br>
    <br>Password &nbsp;&nbsp;<apex:inputsecret value="{!password}"/></br>
    <apex:commandButton value="Login" action="{!loginPage}" reRender="Error"/>
    
    <apex:pageMessages id="Error"></apex:pageMessages> 
    
</apex:pageBlock>
</apex:form>
</apex:page>

Apex Class Code :

public class Sample {      
    public String userName{get;set;}
    public String password{get;set;}
    public List<Account> returns {get;set;}
    
    public Sample(){
    
      returns = new List<Account>();
    }    
    
    public PageReference loginPage(){
    
        returns = [select ID, Name, Sic from Account Where Name=:userName and sic=:password];
        if(!returns.isEmpty()) {
            Pagereference pr = new PageReference('/'+returns[0].Id);
            pr.setReDirect(true);
            return pr;
        }
        else {
                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,'Invalid UserName or Password'));
                return null;
        }
        //Pagereference pr = new PageReference('/'+returns[0].Id);
        //pr.setRedirect(true);
        //return pr;
    }

}






Test Class Code :

@isTest
public class SampleTest{
    public static testMethod void loginPageTestMethod(){
        Sample s=new Sample();
        Account acc=new Account(Name='Kokila');
        insert acc;
        s.loginPage();          
        System.assertEquals(s.pr,'Kokila');
        
    }
}



Thanks in advance
Thulasi
Hi All,

I have to give PPT for SOSL. So, give me some information for that. Plz Don't give google page links. What u have an idea on SOSL, that's enough. I mean What mainly used in organization that topics.

Thanks in advance
Thulasi
Hi All,

I have to give one presentation for SOSL. So, plz provide information for that.
What is SOSL  and what is use of this and syntax and with example. difference between soql and sosl

Thanks in advance
Thulasi.

i have a custom controller "ABC"

in it i had developed a field set named "one"

 

i want to use this field set "one" in our vf page how can i access it...

 

  • March 21, 2011
  • Like
  • 0