• Chinnodu
  • NEWBIE
  • 40 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 76
    Questions
  • 14
    Replies
Hi All,
How to enable  " clone " option in list view control to other users in lightning component . please find attach the screen shot .please help.
User-added image
Thank you ,
Chinnodu
Hi All,

Every time time when ever sandbox is refreshed " life event icons are not appeared ? please suugest the best approach.

 
Hi All,
How to display the first and last characeters before the @ with 5 asterisk betweeen then at email filed EX : (F*****D@***), please do the needful

 
Hi All,

i want  all contacts without Account using soql , how we can achive this using soql 
Hi Expertse , 

i need help on the below scenario... request to throw light on this

lets take an example where a user has logged in , we need to display last date and time using flows without using apex class
Hi All,

please let me know what are the custom components in lightning Component .please explain 
Thanks,
Chinnodu
Hi Experts,

Please let me know whenever i am  inserting or updating records on Account object using batch apex after complition of this, i will send an email to users , how to write the example logic ,,request you  needful.

Thanks,
Chinna
Hi All,

I am trying to create a new record , i am getting below error. please let me know where i did mistake. please help me 

Action failed: Hunarsolution:contactrecordcreation$controller$dosave [action.setparams is not a function] Failing descriptor: {Hunarsolution:contactrecordcreation$controller$dosave}

CODE :

Apex class :

public class Creatcontactdetails {

    @Auraenabled
    public static string createcontact(contact contobj)
    {
        insert contobj;
        return contobj.id;
    }
}


Component page :

<aura:component controller="Creatcontactdetails">
    <aura:attribute name="contactobj" type="contact" default="{'sobjecttype' :'contact',
                                                               'Firstname' :'',
                                                               'LastName'  : '',
                                                               'phone': ''}" />
    <aura:attribute name="contactID" type="string"/>
    <lightning:input value="{!v.contactobj.Firstname}" label="First Name" plaseholder="Enter first Name..."/>
    <lightning:input value="{!v.contactobj.LastName}" label="Last Name" plaseholder="Enter Last Name..."/>
    <lightning:input value="{!v.contactobj.Phone}" label="Phone" plaseholder="Enter Phone number..."/>
    
    <lightning:button variant="brand" label="save" title="save" onclick="{!c.dosave}"/>
    
    
</aura:component>



Controller 

({
    dosave : function(component, event, helper) {
        var action =component.get("c.createcontact");
        action.setparams({'contobj':component.get('v.contactobj')});
        action.setcallback(this,function(data)
        {
             component.set('v.contactID',data.getreturnvalue())              
       });
        $A.enqueueAction(action);
    }
})

Thanks 
Chinnodu
Hi Team,

how we can count the number of a specific visualforce page opened by a user. please provide the example code .

Thanks,
Chinnodu
Hello,

what is differentiate Flexipage and record page in lightning page , could you please explain on this.

Thanks & Regards,
Chinna.
Hi Experts ,
How to Write a trigger  "when an account insert happens trigger should check for the duplicates and should not be case sensitive (I,e it should allow either Lower or Upper case duplicate.

kindly help me 


Thanks,
Chinna
Hi Master developers,

i am getting one callout error kindly suggest me , how can overcome  this error .

timeout: error is 120,000 milliseconds can be exceeded then how we can handle this issue in callouts ?

Thanks,
Chinna
Hi All,

i need update the records an contact object, if record is not there then only we need to insert the records using trigger .kindly help me on this .please give me example with functionality.

Thanks in advance 
 
Hi,

I am getting bellow error.

Hi, 
i am trying to send an email- Sending a Document as an Attachment, i am getting below error.
Anybody can help me on this , exactely where iam getting the error.

Thanks,
Chinnu
public class SendingDocasattachmentExample {
    public pagereference sendDocAttach() {
        Document doc = [SELECT Id,Name FROM Document WHERE Name = 'attachment'];
        Messaging.SingleEmailMessage semail = new Messaging.SingleEmailMessage();
        semail.setDocumentAttachments(new ID[]{doc.id});
        semail.setSubject('Sending Document as attachemnt example');
        String[] sendTo = new String[]{'test.dm2@gmail.com'};
        semail.setToAddresses(sendTo);
        semail.setPlainTextBody('Please find the attached document details');
        Messaging.sendEmail(new Messaging.SingleEmailMessage[]{semail});
        return null;
    }
}

 
Hi All,

How to erase value from text field while updating record?

Reauirement :
i have one text field, while creating a record it is required field and while updating same record, i would be erase value from text field.?

please let me know how can i achive this .Give me example code also.

Thanks in advance.
China
Hi All ,


Here my requirement is while creting a record i need required field and updaing the same record i don't want required field.

Example:
I) I Have one custom object Employee__c and field is DOB.Now  while creating a record i need required field , if value is not there , then it showing required value is missing
 2) I want update on same record then i have remove value from DOB field at that time i don't want required value.

Please suggest me, how can achive with example code.


Thanks in Advance.
Chinna
Hi All,
I am stuck at Step 2. Getting following error :-

Please help me on this .

User-added image
Please see the below code :
 
BoarsearchFormController.js


({
	doInit : function(component, event, helper){
        var action = component.get("c.getBoatTypes");
        action.setCallback(this, function(response) {
            var state = response.getState();
            if (state === "SUCCESS") {
                component.set("v.boatTypes", response.getReturnValue());
            }
            else {
                console.log("Failed with state: " + state);
            }
        });
        // Send action off to be executed
        $A.enqueueAction(action);
    },
    
   
    
    
    createRecord : function (component, event, helper) {
        var BoatTypeid = component.find("boatType").get("v.value");
        var createRecordEvent = $A.get("e.force:createRecord");
        if(!$A.util.isEmpty(BoatTypeid)){
            createRecordEvent.setParams({
                'entityApiName': 'Boat__c',
                'defaultFieldValues':{
                    'BoatType__c' : BoatTypeid
                }
            });
            createRecordEvent.fire();
        }else{
            createRecordEvent.setParams({
                'entityApiName': 'Boat__c'
            });
            createRecordEvent.fire();
        }
    } ,
    eventhandler : function (component, event, helper) {
        
    } */
})



BoatSearchForm.cmp:


<aura:component controller="BoatTypes" implements="force:appHostable,flexipage:availableForAllPageTypes"  access="global" >
    <lightning:card title="Find a Boat"  class="slds-align_absolute-Left" >
    </lightning:card>
   
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>    
    <aura:handler name="init" value="{!this}" action="{!c.newBoat}"/>
    <aura:attribute name="boatTypes" type="BoatType__c[]"/>
     <aura:attribute name="selectedType" type="String" default="foo"/>
    <aura:attribute name="showNewButton" type="boolean" default="true"/>
    
    <!--<aura:registerEvent name="launchNewBoatForm" type="c:launchNewBoatForm"/>
    <aura:handler name="launchNewBoatForm" event="c:launchNewBoatForm" action="{!c.eventhandler}"/>-->


    <lightning:layout horizontalAlign="center" verticalAlign="end">

       <lightning:layoutItem class="slds-grid_vertical-align-center" padding="around-small" > 

           <lightning:select aura:id="boatSelect"  label=""  name="selectItem">
             <aura:iteration items="{!v.boatTypes}" var="boatType">
                 <option value="" text="All Types"/>
                 <option value="{!boatType.id}" text="{!boatType.Name}"></option>
             </aura:iteration>
         </lightning:select>
       </lightning:layoutItem>

       <lightning:layoutItem class="slds-grid_vertical-align-center" padding="around-small"> 
         <lightning:button label="Search" variant="brand"  />
         <aura:if isTrue="{!v.showNewButton}">
            <lightning:button variant="neutral" label="New" onclick="{!c.newBoat}"/>
        </aura:if>
       </lightning:layoutItem>

    </lightning:layout>

</aura:component>

 
Hi All,

How to display the records in visulaforce page without command button and commmand link? kindly suggest me.

Please provide the example withcode .
Thank you,
Chinnodu
Hi All,

I have an account object, I have a status field which has open and completed checkboxes, when ever I click on completed, I want an opportunity to be created automatically.

it will get trigger, how i will get from trigger , any one can help me on this with example functionalty

Thanks,
Chinna
 
Hi All,
Actally i have one custom field<Account_name__c > on custom object (Jibber__c).This field Account_name__c is master detail relationship having on Account.object.

Now i want dispaly readonly with value on visualforcepage. 

Kindly help me..Please see the below my screen shot 
User-added image

Thanks,
Chinni
Hi All,

How to erase value from text field while updating record?

Reauirement :
i have one text field, while creating a record it is required field and while updating same record, i would be erase value from text field.?

please let me know how can i achive this .Give me example code also.

Thanks in advance.
China
Hi All ,


Here my requirement is while creting a record i need required field and updaing the same record i don't want required field.

Example:
I) I Have one custom object Employee__c and field is DOB.Now  while creating a record i need required field , if value is not there , then it showing required value is missing
 2) I want update on same record then i have remove value from DOB field at that time i don't want required value.

Please suggest me, how can achive with example code.


Thanks in Advance.
Chinna
Hi All,

I have an account object, I have a status field which has open and completed checkboxes, when ever I click on completed, I want an opportunity to be created automatically.

it will get trigger, how i will get from trigger , any one can help me on this with example functionalty

Thanks,
Chinna
 
HI Experts,

i have written a test class but i got code coverage 65%, i need more than 75%. kindly help me on this.
 
@istest
public class AccConUpd_test
{
 static testMethod void testMethod1() 
 {
 
 Account testAccount = new Account();
    testAccount.Name='Test Account' ;
    
    insert testAccount;
 
 Contact cont = new Contact();
        cont.FirstName='a1123';
        cont.LastName='rest';
        cont.Accountid= '0019000001xfaMI';
        cont.Employee_Id__c='1091637612';
        cont.PAN_Number__c='apgffg';
        cont.Working_Days_Per_Week__c=7;
        cont.Phone='12344';
        
        insert cont;
 }
}

User-added image


Thanks!

Sai
HI Apex EXPERTSxperts,

I got Below error on Apex class as well as i have attached with my class , Could you please help me

System.NullPointerException: Attempt to de-reference a null object
Error is in expression '{!doAttach}' in component <apex:commandButton> in page gbocase: Class.gboCaseController.doAttach: line 316, column 1
Class.gboCaseController.doAttach: line 316, column 1.
public class gboCaseController {
Public Transient BLOB attachmentBody{get; set;}        
Public String attachmentName{get; set;}
Public Attachment objCaseAtt {get; set;}
public String caseId{get; set;} 
 
Public List<Attachment> lst_attch{get; set;} 
        
    
    public gboCaseController(ApexPages.StandardController controller) {
       objCaseAtt = new Attachment(); 
    
    caseId = ApexPages.CurrentPage().getParameters().get('id');
    }
    
    public Case c { get; set; }
    
    /*Public string str {get; set;}
public List<SelectOption> getTypeOptions() 
{
List<SelectOption> options = new List<SelectOption>();
String Opt = '';
List<String> strList = new List<String>();
List<Channel_Type__c> listVals = Channel_Type__c.getAll().values();
For(Channel_Type__c ChnlType: listVals )
{
if(ChnlType.Case_Type__c=='Channel')
{
Opt =  ChnlType.Record_Type__c;
strList.Add(Opt);      
}
}
strList.sort();
options.add(new SelectOption('','--None--'));
for(String str : strList)
{
options.add(new SelectOption(str,str));
}
return options;
}*/
    
    //CaseVO caseVO = new CaseVO();
    
    //  public CaseRecordType caseRecordType ;
    //   
    /*  public void setCaseVO (CaseVO caseVO ) 
{
caseVO = caseVO;
}
public CaseVO getCaseVO () 
{
return caseVO ;
}   */
    
    public gboCaseController() {
        //c = new Case(RecordTypeId = '012560000000DrN');
        Id recTypeId = [Select Id, Name from RecordType where Name = 'GBOCase'][0].Id;
        c = new Case(RecordTypeId = recTypeId);
        c.Priority = 'Medium';
        //c.Record_Type__C = 'GBOcase';
      
        
    }
    public PageReference submitCase() {
        boolean isMandatoryFailed = false;
        if(c.SuppliedName== null || c.SuppliedName==''){
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Error,'Please Enter Contact Name'));
            isMandatoryFailed = true;   
            
        }
        if(c.SuppliedCompany== null || c.SuppliedCompany==''){
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Error,'Please Enter Company'));   
            isMandatoryFailed = true;   
            
        }
        if(c.SuppliedEmail== null || c.SuppliedEmail=='' ){
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Error,'Please Enter Email'));   
            isMandatoryFailed = true;   
            
        }
        if(c.suppliedEmail.contains('@gmail.com')|| c.suppliedEmail.contains('@yahoo.com')|| c.suppliedEmail.contains('@hotmail.com')){
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Error,'Please enter valid business email'));   
            isMandatoryFailed = true;   
            
        }
        if(c.SuppliedPhone== null || c.SuppliedPhone==''){
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Error,'Please Enter Phone'));   
            isMandatoryFailed = true;   
            
        }
        if(c.To__c== null || c.To__c==''){
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Error,'Please pick up a value from To'));   
            isMandatoryFailed = true;   
        }
        
        if(c.GBO_Type__c== null || c.GBO_Type__c==''){
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Error,'Please pick up a value from GBOType'));   
            isMandatoryFailed = true;   
        }
        if(c.Subject== null || c.Subject==''){
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Error,'Please Enter Subject'));   
            isMandatoryFailed = true;
        }
        if(c.Description== null || c.Description==''){
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Error,'Please Enter Description'));   
            isMandatoryFailed = true;
        }
        if(c.Country__c== null || c.Country__c==''){
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Error,'Please Enter Country'));   
            isMandatoryFailed = true;
        }
        
        if(isMandatoryFailed){
            return null;
        }
        List<String> contList = new List<String>(); 
        try {
            Integer i=0;        
            // now look for an associated contact with the same email
            for(Contact cnt : [SELECT Id,Email FROM Contact WHERE Email = :c.SuppliedEmail]){
                if (cnt != null) {
                    contList.add(cnt.Id);
                    i++;
                }
            }
            If(contList!=null){
                if(i<1){
                    
                }else if(i>1){
                    
                }else if (i==1){
                    for(String contStr :contList)
                    {
                        c.ContactId=contStr;
                    }
                    
                }
            }
            
            
            // c.RecordTypeId=c.Record_Type__c;
            // Specify DML options to ensure the assignment rules are executed
            Database.DMLOptions dmlOpts = new Database.DMLOptions();
            dmlOpts.assignmentRuleHeader.useDefaultRule = true;
            c.setOptions(dmlOpts);
            c.Is_Submitted_From_Site__c = true;
            c.IsVisibleInSelfService = False; 
            // Insert the case
            INSERT c;
            PageReference redirectPage= new PageReference('https://www.rsa.com');
            return redirectPage;//new PageReference('/thanks');
        } catch (Exception e) {
            ApexPages.addMessages(e);
            System.debug('Exception in gboCaseController: '+e);
            return null;
        }
    }
    public PageReference submitCaseWithAttachment() {
        
        boolean isMandatoryFailed = false;
        if(c.SuppliedName== null || c.SuppliedName==''){
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Error,'Please Enter Contact Name'));
            isMandatoryFailed = true;   
            
        }
        if(c.SuppliedCompany== null || c.SuppliedCompany==''){
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Error,'Please Enter Company'));   
            isMandatoryFailed = true;   
            
        }
        if(c.SuppliedEmail== null || c.SuppliedEmail==''){
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Error,'Please Enter Email'));   
            isMandatoryFailed = true;   
            
        }
        if(c.suppliedEmail.contains('@gmail.com')|| c.suppliedEmail.contains('@yahoo.com')|| c.suppliedEmail.contains('@hotmail.com')){
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Error,'Please enter valid business email'));   
            isMandatoryFailed = true;   
            
        }
        if(c.SuppliedPhone== null || c.SuppliedPhone==''){
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Error,'Please Enter Phone'));   
            isMandatoryFailed = true;   
            
        }
        if(c.To__c== null || c.To__c==''){
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Error,'Please pick up a value from To'));   
            isMandatoryFailed = true;   
        }
        if(c.GBO_Type__c== null || c.GBO_Type__c==''){
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Error,'Please pick up a value from GBOType'));   
            isMandatoryFailed = true;   
        }
        if(c.Subject== null || c.Subject==''){
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Error,'Please Enter Subject'));   
            isMandatoryFailed = true;
        }
        if(c.Description== null || c.Description==''){
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Error,'Please Enter Description'));   
            isMandatoryFailed = true;
        }
        if(c.Country__c== null || c.Country__c==''){
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Error,'Please Enter Country'));   
            isMandatoryFailed = true;
        }
        
        if(isMandatoryFailed){
            return null;
        }
        List<String> contList = new List<String>(); 
        try {
            Integer i=0;        
            // now look for an associated contact with the same email
            for(Contact cnt : [SELECT Id,Email FROM Contact WHERE Email = :c.SuppliedEmail]){
                if (cnt != null) {
                    contList.add(cnt.Id);
                    i++;
                }
            }
            If(contList!=null){
                if(i<1){
                    
                }else if(i>1){
                    
                }else if (i==1){
                    for(String contStr :contList)
                    {
                        c.ContactId=contStr;
                    }
                    
                }
            }
            //   c.Type=CaseVO.getType();
            
            // c.RecordTypeId=c.Record_Type__c;
            // Specify DML options to ensure the assignment rules are executed
            Database.DMLOptions dmlOpts = new Database.DMLOptions();
            dmlOpts.assignmentRuleHeader.useDefaultRule = true;
            c.setOptions(dmlOpts);
            c.Is_Submitted_From_Site__c = true;
            // Insert the case
            // INSERT c;
            // Added by Kavitha - Webtocase Attachment - Start               
            Database.SaveResult res = Database.Insert(c,false);
            System.debug('gboCaseController Error: '+res.getErrors());
            PageReference redirectAttachmentPage;
            if(res.getId()!= null)
            {
                case cs = [select id,CaseNumber from case where id =:res.getId()];
                redirectAttachmentPage= new PageReference('/apex/SubmitCaseAttachmentPage?id='+res.getId());
                // redirectAttachmentPage= new PageReference('http://sit-rsa.cs1.force.com/webtocase/p/attach/NoteAttach?pid='+cs.id+'&parentname='+cs.casenumber);
                redirectAttachmentPage.setRedirect(TRUE);
                return redirectAttachmentPage;//new PageReference('/thanks');
            }else
            {
                String strError; 
                for(Database.Error err : res.getErrors()) 
                {
                    strError += err+ ';';
                }
                
                return null;
                
            }
        } catch (Exception e) {
            ApexPages.addMessages(e);
            return null;
        }
    }
    
    //added by viswa from 271 line to 297 line
    
    public List<SelectOption> getPickLstValue()

    {

    List<SelectOption> options = new List<SelectOption>();

     Schema.DescribeFieldResult fieldResult = Case.Priority.getDescribe();

    List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();

    for(Schema.PicklistEntry f : ple)

    {

     if(f.getValue() != 'Hot')

     {

   options.add(new SelectOption(f.getLabel(), f.getValue()));

   }

     }  

           return options;            

  }

    
    public void doAttach()
     {

        String caseid1 = ApexPages.CurrentPage().getParameters().get('id');

       
 
        if(attachmentName == null && attachmentBody == null)        
        {
          ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Error: Please specify a file to upload. Type in the path to the file, or use the "Browse" button to locate it in your local filesystem.'));
        }
        else        
        { 
       
         objCaseAtt.Name     = attachmentName;            
          objCaseAtt.Body     = attachmentBody;           
          objCaseAtt.ParentId = caseId;  
            try{             
          insert(objCaseAtt); 
          }
          catch(exception e){
          ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Error: Please specify a file to upload. Type in the path to the file, or use the "Browse" button to locate it in your local filesystem.'));
          }
          finally{
         objCaseAtt = new attachment();
         
          } 
          
      /*  Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
        efa.setFileName(attachmentName);
        efa.setContentType('application/Pdf');
        efa.setBody(attachmentBody);  
        system.debug('Test---90>>>'+attachmentBody.size());
       // if(attachmentBody.size()<156000) {          
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
        mail.setUseSignature(false);
        mail.setToAddresses( new String[] {System.Label.webtocaseattachinsert});
     //  mail.setToAddresses('udaykumar.pathi@rsa.com');
        mail.setSubject(caseId);
        mail.setPlainTextBody('case attachment');
        mail.setFileAttachments(new Messaging.EmailFileAttachment[] { efa }); 
        Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });*/
      //  }
       /* else{
         ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Error: Size of the file cannot be greater than 150KB.'));*/     

       //}
            lst_attch = new List<attachment>();
            lst_attch = [Select id,name,Parent.name from attachment where parentid =:caseid];
          }
        }
    
}
Regards,
VIswa
 
Hi Experts,
Below is my test class ,
public with sharing class gboclosecaseController {
 public Case caseObj {get;set;}
    public Id tempCaseId {get;set;}    
    public String tempTo {get;set;}
    public String tempCategory {get;set;}
    public String tempRootCause {get;set;}
    public String tempGBOType {get;set;}    
    public String tempSubCategory {get;set;}       
    public String tempInternalComments {get;set;}             
    public Case caseObj1;
    public Case parentCase;
  

    
       public gboclosecaseController(ApexPages.StandardController controller){
        this.caseObj = (Case)controller.getRecord();
        caseObj.RecordTypeID = '012560000000DrN';
         tempCaseId  = ApexPages.currentPage().getParameters().get('previousId');
         tempTo  = ApexPages.currentPage().getParameters().get('To');
         tempCategory  = ApexPages.currentPage().getParameters().get('Category');
         tempRootCause  = ApexPages.currentPage().getParameters().get('RootCause');
         tempGBOType  = ApexPages.currentPage().getParameters().get('GBOType');    
         tempSubCategory  = ApexPages.currentPage().getParameters().get('SubCategory');  
         tempInternalComments= ApexPages.currentPage().getParameters().get('InternalComments'); 

          /* List<Case> childCases = [select id from Case where ParentId=:caseObj.id AND Status!='Closed'];
        if(childCases.size()>0){
             ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error,'You cannot Close Parent Case when any one of the child case is opened. Please close all the open child cases ')); 
                        
                }  */
         
        caseObj1 = [Select Status,ParentId,Id,CaseNumber,To__c,GBO_Type__c,Description,Root_Cause__c from case where id =:caseObj.Id]; 
                          
         system.debug('tempCaseId------------------1'+tempCaseId);    
             

         
          if(tempTo!=null && tempTo!='')
            caseObj.To__c = tempTo;    
              
         if(tempCategory!=null && tempCategory!='')
            caseObj.Category__c = tempCategory;    
            
          if(tempRootCause!=null && tempRootCause!='')
            caseObj.Root_Cause__c = tempRootCause;  
                        
          if(tempGBOType!=null && tempGBOType!='')
            caseObj.GBO_Type__c = tempGBOType;  
            
          if(tempSubCategory!=null && tempSubCategory!='')
            caseObj.SubCategory__c = tempSubCategory;  
            
          if(tempInternalComments!=null && tempInternalComments!='')
            caseObj.Description = tempInternalComments;                         
 
    }
    
    
 public  PageReference NewSave()
    {
      PageReference pageRef = Null;
      
        List<Case> childCases = [select id from Case where ParentId=:caseObj.id AND Status!='Closed'];
        if(childCases.size()>0){
             ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error,'You cannot Close Parent Case when any one of the child case is opened. Please close all the open child cases ')); 
                return null;        
                }  
               
         if (caseObj.To__c != tempTo) 

            { 
                        ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error,'You cannot change the "To" value')); 
                        return null; 
                }  
        
            
      try
     {
     
             if(caseObj1.ParentId !=null)
            {
               // parentCase = new Case();
               parentCase = [select id,CaseNumber,Account.Name,Owner.Email,ParentId from Case where Id=:caseObj1.ParentId];
                parentCase.Id = caseObj1.ParentId;
                parentCase.Status = 'In progress';
                
            }
            
            system.debug('parentCase------------------1'+parentCase);
            system.debug('caseObj1------------------1'+caseObj1);
   
   update caseObj;
   system.debug('caseObj------------------000000000000000000000000000000000000000'+caseObj);
   
            if(caseObj1.ParentId !=null)
            {       
                update parentCase;
            }
            
             if(caseObj1.ParentId !=null)
            {
        
        //Send an Email

        EmailTemplate et = [SELECT Id, Subject, HtmlValue, Body FROM EmailTemplate WHERE Name = 'GBOCASE02'];
        system.debug('SendEmail');

        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
       
                
        string CaseNumber=caseObj1.CaseNumber==null?'':caseObj1.CaseNumber;
        string ParentCaseNumber=parentCase.CaseNumber==null?'':parentCase.CaseNumber;
        string Accnt=caseObj.Account.Name==null?'':caseObj.Account.Name;
        //string OwnerName=parentCase.Owner.Name==null?'':parentCase.Owner.Name;
        string OwnerName=parentCase.Owner.Email;
        
        system.debug('SendEmail'+OwnerName);
        string To=caseObj.To__c==null?'':caseObj.To__c;
        string GBOType=caseObj.GBO_Type__c==null?'':caseObj.GBO_Type__c;
        string Reason=caseObj.Reason==null?'':caseObj.Reason;
        string Descrptn=caseObj.Description==null?'':caseObj.Description;
        string RootCause=caseObj.Root_Cause__c==null?'':caseObj.Root_Cause__c;


        
        String subject = et.Subject;
        subject = subject.replace('{!Case.CaseNumber}', CaseNumber);
        subject = subject.replace('{!Case.Parent}', ParentCaseNumber);

    
        String htmlBody = et.HtmlValue;
        htmlBody = htmlBody.replace('{!Case.CaseNumber}', CaseNumber);
        htmlBody = htmlBody.replace('{!Case.Parent}', ParentCaseNumber);
        htmlBody = htmlBody.replace('{!Case.To__c}', To);
        htmlBody = htmlBody.replace('{!Case.GBO_Type__c}', GBOType);
        htmlBody = htmlBody.replace('{!Case.Reason}', Reason);
        htmlBody = htmlBody.replace('{!Case.Description}', Descrptn);
        htmlBody = htmlBody.replace('{!Case.Root_Cause__c}', RootCause);
       
        mail.setSenderDisplayName('RSA Notification');
        mail.setInReplyTo('noreply@rsa.com');
        mail.setSubject(subject);
        mail.setHtmlBody(htmlBody);
        mail.setToaddresses(new String[] {OwnerName});
        
        system.debug('SingleEmail.svp'+mail);
       // Messaging.sendEmail(new Messaging.SingleEmailMessage[] {mail});
    } 
   
    
      
     } 
    
     
     catch(Exception e){
                ApexPages.addMessages(e);
                return null;
            }              
  
      
    
     pageRef = new PageReference('/apex/CaseView?id='+caseObj.Id);
     return pageRef;
    }
}


********************************************** here my test class  *********************

@isTest(SeeAllData=true)
public class gboclosecaseController_test{

        public static testMethod void gboclosecase(){
        case objCase=new Case(status='New',Origin='Phone');
        insert objCase;
       
 
                 
        case objCase1=new Case(status='New',Origin='Phone',ParentId=objCase.Id);
        EmailTemplate et = new EmailTemplate (Subject='Test',HtmlValue='gbocase',Body ='templete');
       
        //insert et;
        /*list<case> cn =new list<case>();
     
        cn.add(new case(status='New',Origin='Phone',ParentId=objCase.Id));
        insert cn;*/
       
               
               
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
       
        ApexPages.currentPage().getParameters().put('caseId',objCase.Id);
        ApexPages.StandardController sc = new ApexPages.StandardController(objCase);
        gboclosecaseController GCC= new gboclosecaseController (sc);
       
       
         GCC.NewSave();
      
        
       
            }
}
Hi All,

I am writing a test class on Entitelement  . in this object we have lookupfileds to Entitlement object.
Thesre are lookup fileds
CAS_Entitlement__c,DSE_Entitlement__c,OSE_Entitlement__c.
i got this error
System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [AccountId]: [AccountId]

Below is my test class and also i got error , could you please can any one help.

@istest(SeeAllData=true)
public class caseSupportPortalControllerGS_test
{

      public static testMethod void caseCust()
      {
        
        case objCase=new Case(status='New',Origin='Phone',Subject='RSA',Type__c='Technical',PL_RSA_Product_Set__c='DLP',
        PL_RSA_Product__c='Archer',PL_RSA_Version_Condition__c='5.3',
        Issue_Type__c='SA missing csas rules',Platform__c='windows');
        insert objCase;
        case objCase1=new Case(status='New',Origin='Phone');
        RSA_Product_Set__c objRSA=new RSA_Product_Set__c(Name='test',Type__c='Technical Support');
        insert objRSA;                      
        Account a = new Account(Name='Test01',Country__c='India',City__c='Chennai',Street__c='karapakam');
        insert a;
        
        Entitlement objEntl=new Entitlement(Name='test',Startdate=system.today(),MSSP_Account_Name__c='Test2');
        insert objEntl;
        
        Entitlement objEnt2=new Entitlement();
      
        objEnt2.Name='test';
        objEnt2.Startdate=system.today();
        objEnt2.CAS_Entitlement__c=objEntl.id;
        objEnt2.DSE_Entitlement__c=objEntl.id;
        objEnt2.OSE_Entitlement__c=objEntl.id;
        objEnt2.TAM_Entitlement__c=objEntl.id;
        objEnt2.Name=a.id;
      
        
        insert objEnt2;
        

                
        ApexPages.currentPage().getParameters().put('caseId',objCase.Id);
       
        ApexPages.StandardController sc = new ApexPages.StandardController(objCase);
        caseCustomerSupportPortalControllerGS contr = new caseCustomerSupportPortalControllerGS(sc);
        
        PageReference pageRef = Page.caseCustomerSupport_PortalVFGS;
        Test.setCurrentPage(pageRef);
        
        contr.getSevItems();
        contr.runSearch();
        contr.ArticleView();
        contr.submitAttachment();
        contr.NewSave();
        contr.routetoProperQueue(objCase1);
        contr.updateEntitlementIcons('test');
        contr.CollectVersionConditionList();
        contr.CollectProductSetList();
        contr.CollectProductList();
        
        
            
    }

Regrads,
VIswa
H i All,

How to we can write multiple batch sizes (indidual size )in single batch apex.class

Can you pls explian me with one example.


Regards,
Viswa.
HI,
i am phasing this issue variable  doesnot exist.

trigger updatephonecontact on Account (after update)
{
 for(account acc : trigger.new)
 {
 list<contact> listcon= [select phone from contact where accountid=:acc.id];
 }
/for(Contact ct : listcon)
 {
 
 ct.phone=acc.phone ;// i got error at his line can ypo pls help me
 }
 update listcon;
}
   how to  write a code   i have one tab , that tab is Search job , u can clickied on  the tab then it will go to next page. i wanted code in vf page and apex class? by using pagerefrence, kindely give me reply