• kumar.fdc81.3902978579608325E12
  • NEWBIE
  • 70 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 50
    Questions
  • 75
    Replies
Hi all,
I am getting this error when i am executing Test class.
System.AsyncException: The Apex job named already scheduled for execution.

Thanks
Hi all,

I am getting this error when i put system.debug

Error:- Attempt to de-reference a null object
In this line i am getting error
system.debug('ProertyVisit Length - '+ p.Visit_Restrictions__c.length());

Thanks
Hi all,

I am getting this error when i executing the Batch

ERROR System.LimitException: Apex heap size too large: 13877540

give me any suggestions.

Thanks
Hi all,

I am written one trigger and test class.. Test class code covered 73% i need to increase more.
Trigger:-
trigger UpdatePropertybyGroup on Property__c (after insert, after update) {
    
    Set<Object> Properties = new set<Object>();
    Map< String, Set<Object> > PropertiesPerAccount = new Map< String, Set<Object> >();
    Map< String, Object> AllProperties = new Map<String, Object>();
    Set< String> AllIdsOfproperties = new Set<String>();
    List<Property__c> NeedToUpdateGroupProperties = new List<Property__c>();
     Property__c p1 = Trigger.new[0];
    
    if(   p1.Account__c == '001f000000l10C5' ) {
    for(Property__c p : Trigger.new){
        AllProperties.put( p.Account__c , p);
        AllIdsOfproperties.add(p.Id);
    }
    set<String>AccountIds = AllProperties.keySet();

    for( String account: AccountIds ){
        Properties.clear();
        for( String propAccount :AllProperties.keySet() ) {
            if( AllProperties.containsKey( account ) )
                Properties.add( AllProperties.get( account ) );
        }
        PropertiesPerAccount.put( account , Properties);
    }
    
    List<Property__c> SFDCproperties = [Select Id,name,Account__c,Group_Membership__c from Property__c where Id In :AllIdsOfproperties];
    List<Grouping__c> SFDCGroups     = [Select Id,name,Account__c from Grouping__c where Account__c IN : AccountIds];
    Map<String, String> NewGroupPerAccount = new Map<String, String>();
    set<String> UniqueGroupName = new set<String>();
    List<Grouping__c> groups      = new List<Grouping__c>();
    
    for(Property__c p :SFDCproperties) {
        if( null == p.Group_Membership__c ) {
            if( ! SFDCGroups.isEmpty() ) {
                Boolean IsGroupExists = false;
                for( Grouping__c grp : SFDCGroups ) {
                    if( grp.Name == p.Name ) {
                        IsGroupExists = true;
                        p.Group_Membership__c = grp.Id;  
                        NeedToUpdateGroupProperties.add(p);
                        break;
                    } else {
                        IsGroupExists = false;
                       
                    }
                }
                
                if( false == IsGroupExists ) {
                    if(!UniqueGroupName.contains(p.Name)){
                        Grouping__c g = new Grouping__c();
                        g.Name = p.Name;
                        g.Account__c = p.Account__c;
                        groups.add(g);
                        UniqueGroupName.add(p.Name);
                    }
                }
            } else {
                if(!UniqueGroupName.contains(p.Name)){
                    Grouping__c g = new Grouping__c();
                    g.Name = p.Name;
                    g.Account__c = p.Account__c;
                    groups.add(g);
                    UniqueGroupName.add(p.Name);
                }
            }
        } 
    }
    
    if( !groups.isEmpty() )
        upsert groups;
    
    for(Property__c p :SFDCproperties){
        for(Grouping__c grp : groups){
            if(grp.Name == p.Name){
                p.Group_Membership__c = grp.Id;  
                NeedToUpdateGroupProperties.add(p);
            }
        }
    }
    if( !NeedToUpdateGroupProperties.isEmpty() )
        update NeedToUpdateGroupProperties;
}
}    

Test class:-
@isTest
public class TestUpdatePropertybyGroup {
    @isTest static void updateproperty() {
       
        Account a = new Account(Name ='Test');
        insert a;
        Property__c p = new Property__c(Name ='Testing', Active__c = 'ýes', Price__c =1,Square_Footage__c = 1,Bed_Count__c =1, Bath_Count__c =1, Pet_Policy__c ='No',Lease_Terms__c = 1,Address_Line_1__c = 'Test', City__c ='Test', State__c='Test', Zip_Code__c ='1',Concurrent_Showings_Allowed__c= 'no', Default_Appointment_Length__c ='no', Default_Buffer_Before_Appointments__c ='no');
        insert p;
        Grouping__c g = new Grouping__c(Name = 'Testing');
        insert g;
        
    }
}

Thanks in adv.
 
Hi all,

I don't want to display special character in a field.
suppose i have one field in that field values are : A & B
But I need output  A and B like this.
I created a class but it's not working Please help me.

public class CommonFunctions {
    public void RemovingSpecialCharacters(){
        List<case> listcase = new  List<case>();
        String specialCharacters = '&';
        if(listcase.Notes__c.Contains('/&')){
            listcase.Notes__c = 'And';
            }        
    }
}
Hi all,

I am getting this error: There is an error in XML document (1, 818).

Can you please give me any suggessions.

Thanks
kumar
Hi all,

I am clicking on save button record is not inserting...

VF Page:-
------------

<apex:page standardController="Employee1__c" tabStyle="Employee1__c" extensions="Thirdware">
 <apex:form >
  <apex:pageBlock id="first">
   <apex:pageblockSection title="First Page">
    <apex:inputfield value="{!Employee1__c.FirstName__c}" />
    <apex:inputfield value="{!Employee1__c.LastName__c}" />
   </apex:pageblockSection>
 
   <apex:outputPanel id="second">
   <apex:outputPanel rendered="{!show}">
   <apex:pageBlockSection title="Second page">
   
    <apex:inputfield value="{!Employee1__c.Employee2__c}" />
    <apex:inputfield value="{!Employee1__c.Picklist__c}" /> 
    <apex:commandButton value="Approved" />
    <apex:commandButton value="Rejected" /> 
    </apex:pageBlockSection>
    </apex:outputPanel>   
    </apex:outputPanel>
 
 <apex:pageBlockButtons location="Bottom">
  <apex:actionRegion >
   <apex:commandButton value="Save" action="{!savedata}">
   <apex:actionSupport reRender="second" event="onchange"/>
   </apex:commandButton>
   </apex:actionRegion>
  </apex:pageBlockButtons>
  </apex:pageBlock>
 </apex:form>
</apex:page>


Apex class:-
----------------
public with sharing class Thirdware {

    public Boolean show{get;set;}
    public string LastName{set;get;}
    public string FirstName{set;get;} 
    public Employee1__c emp {set;get;} 
    
    public Thirdware(ApexPages.StandardController controller) {
     show = false;
    }    
    
    public void savedata(){
     emp = new Employee1__c();
     emp.FirstName__c = FirstName;
     emp.LastName__c = LastName;
     try{
     insert emp;
    }catch(Exception e){
   }
   }
    public boolean Save(){
    
     show = true;
     return null;
    }    
}


Regards
Sam
Hi all,

I Overrided in CLONE button.

VF Page:-
------------

<apex:page standardController="Opportunity_Deal_Risk_Assessment__c" extensions="OpportuintyDealClone"> <apex:form > <script type="text/javascript"> function doValidation() { // do checks here if(Opportunity_Deal_Risk_Assessment__c.CreatedById = Opportunity_Deal_Risk_Assessment__c.User__c) { return false; } //etc. if(Opportunity_Deal_Risk_Assessment__c.CreatedById != Opportunity_Deal_Risk_Assessment__c.User__c) return true; } </script> <apex:pageBlock title="Opportunity Deal Risk Assessment Edit"> <apex:pageblockSection title="Approval" columns="1"> <apex:inputField value="{!Opportunity_Deal_Risk_Assessment__c.PD_Delivery__c}" required="true"/> <!-- <apex:inputField value="{!Opportunity_Deal_Risk_Assessment__c.DealRiskAssessmentPDDelivery__c}" /> --> <apex:inputField value="{!Opportunity_Deal_Risk_Assessment__c.User__c}" required="true"/> </apex:pageblockSection> <apex:pageblockSection title="Area Project Size" columns="1"> <apex:inputField value="{!Opportunity_Deal_Risk_Assessment__c.Opportunity__c}"/> <apex:inputField value="{!Opportunity_Deal_Risk_Assessment__c.ProjectSize_Total_Number_of_Person_Days__c}" required="true"/> </apex:pageblockSection> <apex:pageblockSection title="Area Complexity" columns="1"> <apex:inputField value="{!Opportunity_Deal_Risk_Assessment__c.Complexity_Standard_impl_package__c}" required="true"/> <apex:inputField value="{!Opportunity_Deal_Risk_Assessment__c.Complexity_Countries_Regions_in_scope__c}" required="true"/> <apex:inputField value="{!Opportunity_Deal_Risk_Assessment__c.Complexity_Decision_Making__c}" required="true"/> </apex:pageblockSection> <apex:pageblockSection title="Area Solution Fit and Business Benefit" columns="1"> <apex:inputField value="{!Opportunity_Deal_Risk_Assessment__c.Solution_Fit_Requirements__c}" required="true"/> <apex:inputField value="{!Opportunity_Deal_Risk_Assessment__c.Solution_Fit_Business_Benefits__c}" required="true"/> <apex:inputField value="{!Opportunity_Deal_Risk_Assessment__c.Solution_Fit_Solution_Fit__c}" required="true"/> <apex:inputField value="{!Opportunity_Deal_Risk_Assessment__c.Solution_Fit_Product_Availability__c}" required="true"/> </apex:pageblockSection> <apex:pageblockSection title="Area Productization, Customizations, and Extension" columns="1"> <apex:inputField value="{!Opportunity_Deal_Risk_Assessment__c.Productization_Complexity__c}" required="true"/> <apex:inputField value="{!Opportunity_Deal_Risk_Assessment__c.Productization_Deal_type__c}" required="true"/> <apex:inputField value="{!Opportunity_Deal_Risk_Assessment__c.Productization_Customization_Maintenance__c}" required="true"/> <apex:inputField value="{!Opportunity_Deal_Risk_Assessment__c.Productization_Integration_complexity__c}" required="true"/> <apex:inputField value="{!Opportunity_Deal_Risk_Assessment__c.Productization_Integration_deal_type__c}" required="true"/> <apex:inputField value="{!Opportunity_Deal_Risk_Assessment__c.Productization_Report_Volume__c}" required="true"/> <apex:inputField value="{!Opportunity_Deal_Risk_Assessment__c.Productization_Report_complexity__c}" required="true"/> <apex:inputField value="{!Opportunity_Deal_Risk_Assessment__c.Productization_Report_deal_type__c}" required="true"/> </apex:pageblockSection> <apex:pageblockSection title="Area Contract/SOW" columns="1"> <apex:inputField value="{!Opportunity_Deal_Risk_Assessment__c.Contract_SOW_Penalties__c}" required="true"/> <apex:inputField value="{!Opportunity_Deal_Risk_Assessment__c.Contract_SOW_Proposal_type__c}" required="true"/> <apex:inputField value="{!Opportunity_Deal_Risk_Assessment__c.Contract_SOW_Project_Margin__c}" required="true"/> <apex:inputField value="{!Opportunity_Deal_Risk_Assessment__c.Contract_SOW_Project_rates__c}" required="true"/> </apex:pageblockSection> <apex:pageblockSection title="Area Customer Capability" columns="1"> <apex:inputField value="{!Opportunity_Deal_Risk_Assessment__c.Customer_Project_Sponsor__c}" required="true"/> <apex:inputField value="{!Opportunity_Deal_Risk_Assessment__c.Customer_decision_making_sales_cycle__c}" required="true"/> <apex:inputField value="{!Opportunity_Deal_Risk_Assessment__c.Customer_PM_capability__c}" required="true"/> <apex:inputField value="{!Opportunity_Deal_Risk_Assessment__c.Customer_IT_capability__c}" required="true"/> <apex:inputField value="{!Opportunity_Deal_Risk_Assessment__c.Customer_Business_Process_Flexibility__c}" required="true"/> <apex:inputField value="{!Opportunity_Deal_Risk_Assessment__c.Customer_Existing_systems__c}" required="true"/> </apex:pageblockSection> <apex:pageblockSection title="Area SumTotal PS Staffing" columns="1"> <apex:inputField value="{!Opportunity_Deal_Risk_Assessment__c.SumTotal_Offshore_bgt_of_tot_proj_hrs__c}" required="true"/> <apex:inputField value="{!Opportunity_Deal_Risk_Assessment__c.SumTotal_Proj_Mgt_of_tot_proj_bgt_hrs__c}" required="true"/> <apex:inputField value="{!Opportunity_Deal_Risk_Assessment__c.SumTotal_STS_Staffing_Gaps__c}" required="true"/> <apex:inputField value="{!Opportunity_Deal_Risk_Assessment__c.SumTotal_3rd_Party_Resources__c}" required="true"/> </apex:pageblockSection> <apex:pageblockSection title="Area Project Management" columns="1"> <apex:inputField value="{!Opportunity_Deal_Risk_Assessment__c.Project_Scope_definition_days__c}" required="true"/> <apex:inputField value="{!Opportunity_Deal_Risk_Assessment__c.RD_Total_deal_contingency__c}" required="true"/> <apex:inputField value="{!Opportunity_Deal_Risk_Assessment__c.Project_Methodology__c}" required="true"/> <apex:inputField value="{!Opportunity_Deal_Risk_Assessment__c.Project_ST_Project_Experience__c}" required="true"/> <apex:inputField value="{!Opportunity_Deal_Risk_Assessment__c.Project_Education__c}" required="true"/> </apex:pageblockSection> <apex:pageblockSection title="Area Conversion" > <apex:inputField value="{!Opportunity_Deal_Risk_Assessment__c.Conversion_Dataconversion_responsibility__c}" required="true"/> </apex:pageblockSection> <apex:pageBlockButtons > <apex:actionFunction action="{!cloneRecord}" name="callAction"/> <apex:commandButton value="Save" action="{!cloneRecord}" onclick="if(doValidation()) callAction();"/> <apex:commandButton value="Save & New"/> <apex:commandButton value="Cancel" action="{!Cancel}"/> </apex:pageBlockButtons> </apex:pageBlock> </apex:form> </apex:page>

Apex Class:-
----------------

public with sharing class OpportuintyDealClone {

   Public Opportunity_Deal_Risk_Assessment__c currentRecord {get;set;}
   public Opportunity_Deal_Risk_Assessment__c newRecord {get; set;}
   
 public OpportuintyDealClone (ApexPages.StandardController controller) 
    {
     newRecord = new Opportunity_Deal_Risk_Assessment__c();
     
     currentRecord = (Opportunity_Deal_Risk_Assessment__c)controller.getRecord();
     
/*     currentRecord = [select Id,PD_Delivery__c,Opportunity__c,ProjectSize_Total_Number_of_Person_Days__c,Complexity_Standard_impl_package__c,Complexity_Countries_Regions_in_scope__c,
                       Complexity_Decision_Making__c,Solution_Fit_Requirements__c,Solution_Fit_Business_Benefits__c,Solution_Fit_Solution_Fit__c,Solution_Fit_Product_Availability__c,
                       Productization_Complexity__c,Productization_Deal_type__c,Productization_Customization_Maintenance__c,Productization_Integration_complexity__c,
                       Productization_Integration_deal_type__c,Productization_Report_Volume__c,Productization_Report_complexity__c,Productization_Report_deal_type__c,
                       Contract_SOW_Penalties__c,Contract_SOW_Proposal_type__c,Contract_SOW_Project_Margin__c,Contract_SOW_Project_rates__c,Customer_Project_Sponsor__c,
                       Customer_decision_making_sales_cycle__c,Customer_PM_capability__c,Customer_IT_capability__c,Customer_Business_Process_Flexibility__c,Customer_Existing_systems__c,
                       SumTotal_Offshore_bgt_of_tot_proj_hrs__c,SumTotal_Proj_Mgt_of_tot_proj_bgt_hrs__c,SumTotal_STS_Staffing_Gaps__c,SumTotal_3rd_Party_Resources__c,
                       Project_Scope_definition_days__c,RD_Total_deal_contingency__c,Project_Methodology__c,Project_ST_Project_Experience__c,Project_Education__c,
                       Conversion_Dataconversion_responsibility__c from Opportunity_Deal_Risk_Assessment__c where id =:currentRecord.id];
  */                      
  //    newRecord.Name= currentRecord.Name;
       newRecord.PD_Delivery__c= currentRecord.PD_Delivery__c;   
      newRecord.Opportunity__c= currentRecord.Opportunity__c;
      newRecord.ProjectSize_Total_Number_of_Person_Days__c= currentRecord.ProjectSize_Total_Number_of_Person_Days__c;
      newRecord.Complexity_Standard_impl_package__c= currentRecord.Complexity_Standard_impl_package__c;
      newRecord.Complexity_Countries_Regions_in_scope__c= currentRecord.Complexity_Countries_Regions_in_scope__c;
      newRecord.Complexity_Decision_Making__c= currentRecord.Complexity_Decision_Making__c;
      newRecord.Solution_Fit_Requirements__c= currentRecord.Solution_Fit_Requirements__c;
      newRecord.Solution_Fit_Business_Benefits__c= currentRecord.Solution_Fit_Business_Benefits__c; 
      newRecord.Solution_Fit_Solution_Fit__c= currentRecord.Solution_Fit_Solution_Fit__c;  
      newRecord.Solution_Fit_Product_Availability__c= currentRecord.Solution_Fit_Product_Availability__c;
      newRecord.Productization_Complexity__c= currentRecord.Productization_Complexity__c;
      newRecord.Productization_Deal_type__c= currentRecord.Productization_Deal_type__c;
      newRecord.Productization_Customization_Maintenance__c= currentRecord.Productization_Customization_Maintenance__c;
      newRecord.Productization_Integration_complexity__c= currentRecord.Productization_Integration_complexity__c;
      newRecord.Productization_Integration_deal_type__c= currentRecord.Productization_Integration_deal_type__c;
      newRecord.Productization_Report_Volume__c= currentRecord.Productization_Report_Volume__c;
      newRecord.Productization_Report_complexity__c= currentRecord.Productization_Report_complexity__c;
      newRecord.Productization_Report_deal_type__c= currentRecord.Productization_Report_deal_type__c;
      newRecord.Contract_SOW_Penalties__c= currentRecord.Contract_SOW_Penalties__c;
      newRecord.Contract_SOW_Proposal_type__c= currentRecord.Contract_SOW_Proposal_type__c;
      newRecord.Contract_SOW_Project_Margin__c= currentRecord.Contract_SOW_Project_Margin__c;
      newRecord.Contract_SOW_Project_rates__c= currentRecord.Contract_SOW_Project_rates__c;
      newRecord.Customer_Project_Sponsor__c= currentRecord.Customer_Project_Sponsor__c;
      newRecord.Customer_decision_making_sales_cycle__c= currentRecord.Customer_decision_making_sales_cycle__c;
      newRecord.Customer_PM_capability__c= currentRecord.Customer_PM_capability__c;
      newRecord.Customer_IT_capability__c= currentRecord.Customer_IT_capability__c;
      newRecord.Customer_Business_Process_Flexibility__c= currentRecord.Customer_Business_Process_Flexibility__c;
      newRecord.Customer_Existing_systems__c= currentRecord.Customer_Existing_systems__c;
      newRecord.SumTotal_Offshore_bgt_of_tot_proj_hrs__c= currentRecord.SumTotal_Offshore_bgt_of_tot_proj_hrs__c;
      newRecord.SumTotal_Proj_Mgt_of_tot_proj_bgt_hrs__c= currentRecord.SumTotal_Proj_Mgt_of_tot_proj_bgt_hrs__c;
      newRecord.SumTotal_STS_Staffing_Gaps__c= currentRecord.SumTotal_STS_Staffing_Gaps__c;
      newRecord.SumTotal_3rd_Party_Resources__c= currentRecord.SumTotal_3rd_Party_Resources__c;
      newRecord.Project_Scope_definition_days__c= currentRecord.Project_Scope_definition_days__c;
      newRecord.RD_Total_deal_contingency__c= currentRecord.RD_Total_deal_contingency__c;
      newRecord.Project_Methodology__c= currentRecord.Project_Methodology__c;
      newRecord.Project_ST_Project_Experience__c= currentRecord.Project_ST_Project_Experience__c;
      newRecord.Project_Education__c= currentRecord.Project_Education__c;
      newRecord.Conversion_Dataconversion_responsibility__c = currentRecord.Conversion_Dataconversion_responsibility__c ;
      /**If( newRecord.CreatedById = newRecord.User__c){
      
      //newRecord.User__c =  currentRecord.User__c  ;
      }   **/ 
    }
    
     public PageReference cloneRecord()
    {
        //Variable to hold the new record
        
        Savepoint sp = Database.setSavepoint();
        
          try
        {
        }catch(Exception e){
         Database.rollback(sp);
            ApexPages.addMessages(e);
       return null;
     } 
 
        return new PageReference('/'+newRecord.id);
  }
}


Custom Clone Button:-
-------------------------------
 /apex/OpportuintyDealClone?id={!Opportunity_Deal_Risk_Assessment__c.Id}

Thanks
samUser-added image
Hi All,

I created one component, Field(Request_Managerial_Approval__c) This field is not working properly.

Problem:- when i select field(Peer_Reviewer__c) i need to visible this Field(Request_Managerial_Approval__c) it's working fine.

But when i select field(Peer_Reviewer__c) and click on save(means i am not enter any value of this Field(Request_Managerial_Approval__c),. after reopen the record this Field(Request_Managerial_Approval__c) is disabling.
i need to enable when i reopen or when i enter the value (Peer_Reviewer__c).

<apex:component id="cmpCaseODC" allowDML="true">
   
 <apex:attribute name="thisCon" type="NewCase" required="true" description="controller passed from parent" />
  <apex:pageBlockSection title="Contact Information" collapsible="false">

    <apex:outputField value="{!thisCon.theCase.OwnerId}"/>
    <apex:pageBlockSectionItem >
      <apex:outputLabel value="Case Record Type" />
      <apex:outputText value="{!thisCon.caseRTName}" />
    </apex:pageBlockSectionItem>

    <apex:outputField value="{!thisCon.theCase.CaseNumber}"/>
    <apex:inputField value="{!thisCon.theCase.ParentId}"/>
    <apex:outputField value="{!thisCon.theCase.AccountId}"/>
       
 <apex:outputField value="{!thisCon.theCase.Entitlement__c}"/>
 <apex:outputField value="{!thisCon.theCase.ContactId}"/>
    <apex:outputField value="{!thisCon.theAsset.Support_Entitlement__r.Contract_Security_Restrictions__c}"/>
    <apex:outputField rendered="{!NOT(thisCon.isEUCase)}" value="{!thisCon.theCaseContact.Email}"/>
     <apex:outputField value="{!thisCon.theCase.Support_Level_formula__c}"/>
     
    <apex:outputField rendered="{!NOT(thisCon.isEUCase)}" value="{!thisCon.theCaseContact.Phone}"/>
     
     <apex:inputField value="{!thisCon.theCase.Customer_Reference_Number__c}"/>
     

    <apex:inputField value="{!thisCon.theCase.Internal_Contact_Name__c}"/>
     <apex:outputField value="{!thisCon.theCase.Reporting_Office__c}"/>
    

    <apex:pageBlockSectionItem >
      <apex:outputLabel value="Internal Department" />
      <apex:outputText value="{!thisCon.internalContactDepartment}"/>
    </apex:pageBlockSectionItem>
       
    
    <apex:inputField value="{!thisCon.theCase.Performance_Governance_Case__c}" />
    <apex:inputField value="{!thisCon.theCase.Reason_for_Referral__c}" />
    <apex:inputField value="{!thisCon.theCase.Sent_Survey__c}" />
    <apex:inputField value="{!thisCon.theCase.Approval_Status__c}" />    
    <apex:inputField id="selReqApproval" value="{!thisCon.theCase.Request_Approval__c}" /> 
    
    <apex:inputField id="am" onblur="setRequestApproval(this);" value="{!thisCon.theCase.Approving_Manager__c}" rendered="{!thisCon.caseRTName == 'OD Change'}" id="am" />
        
    <apex:outputField value="{!thisCon.theCase.Approving_Manager_Date__c}"  rendered="{!thisCon.caseRTName == 'OD Change'}" />
    <apex:pageBlockSectionItem >
    <apex:outputLabel value="Risk Assessment" rendered="{!thisCon.caseRTName == 'OD Change'}"></apex:outputLabel>
    <apex:actionRegion >
    
            
    <apex:inputField onblur="setManagerialApprovalRisk(this);" id="selRisk" value="{!thisCon.theCase.Risk_Assessment__c}" rendered="{!thisCon.caseRTName == 'OD Change'}"> 
     <apex:actionSupport event="onchange" rerender="pr,prr" />      
    </apex:inputField>
    </apex:actionRegion>
    </apex:pageBlockSectionItem>
  
   <apex:pageBlockSectionItem >
   <apex:outputLabel value="Peer Reviewer" rendered="{!thisCon.caseRTName == 'OD Change'}"></apex:outputLabel>
   <apex:outputPanel id="pr"> 
   
   <apex:outputPanel rendered="{!if(thisCon.theCase.Risk_Assessment__c != null,true,false)}">  
   <apex:inputField onblur="return setManagerialApproval(this);" value="{!thisCon.theCase.Peer_Reviewer__c}" rendered="{!thisCon.caseRTName == 'OD Change'}" >
   </apex:inputField>
   </apex:outputPanel>
   
   </apex:outputPanel> 
   </apex:pageBlockSectionItem>

    <apex:inputField id="chkManageApprove" value="{!thisCon.theCase.Request_Managerial_Approval__c}" rendered="{!thisCon.caseRTName == 'OD Change'}"/>

    <apex:outputField value="{!thisCon.theCase.Peer_Reviewer_Date__c}"  rendered="{!thisCon.caseRTName == 'OD Change'}" />
    <apex:inputField value="{!thisCon.theCase.SOP_Referenced__c}" rendered="{!thisCon.caseRTName == 'OD Change'}" required="true"/> 
    <apex:inputField value="{!thisCon.theCase.SOP_Version__c}" rendered="{!thisCon.caseRTName == 'OD Change'}" required="true"/> 
   

   </apex:pageBlockSection>
  <script>

        document.getElementById('j_id0:j_id6:j_id432:j_id433:j_id487:j_id491:cmpCaseODC:j_id492:chkManageApprove').disabled = true;
        if(document.getElementById('j_id0:j_id6:j_id432:j_id433:j_id487:j_id491:cmpCaseODC:j_id492:am') != null){
            if(document.getElementById('j_id0:j_id6:j_id432:j_id433:j_id487:j_id491:cmpCaseODC:j_id492:am').value != ''){
                document.getElementById('j_id0:j_id6:j_id432:j_id433:j_id487:j_id491:cmpCaseODC:j_id492:selReqApproval').disabled = false;
            }else{
                document.getElementById('j_id0:j_id6:j_id432:j_id433:j_id487:j_id491:cmpCaseODC:j_id492:selReqApproval').disabled = true;
            }
        
        }
        function setManagerialApproval(lkp){

            if(lkp.value != ''){
                document.getElementById('j_id0:j_id6:j_id432:j_id433:j_id487:j_id491:cmpCaseODC:j_id492:chkManageApprove').disabled = false;
                return false;
            }else{
                document.getElementById('j_id0:j_id6:j_id432:j_id433:j_id487:j_id491:cmpCaseODC:j_id492:chkManageApprove').disabled = true;
                document.getElementById('j_id0:j_id6:j_id432:j_id433:j_id487:j_id491:cmpCaseODC:j_id492:chkManageApprove').checked = false;
                return false;
            }
            return false;
        }
        function setManagerialApprovalRisk(selList){

            if(selList.value == ''){
                document.getElementById('j_id0:j_id6:j_id432:j_id433:j_id487:j_id491:cmpCaseODC:j_id492:chkManageApprove').disabled = true;
                document.getElementById('j_id0:j_id6:j_id432:j_id433:j_id487:j_id491:cmpCaseODC:j_id492:chkManageApprove').checked = false;
                return false;
            }
            return true;
        
        }
        function setRequestApproval(lkp){

            if(lkp.value != ''){
                document.getElementById('j_id0:j_id6:j_id432:j_id433:j_id487:j_id491:cmpCaseODC:j_id492:selReqApproval').disabled = false;
                return false;
            }else{
                document.getElementById('j_id0:j_id6:j_id432:j_id433:j_id487:j_id491:cmpCaseODC:j_id492:selReqApproval').disabled = true;
                document.getElementById('j_id0:j_id6:j_id432:j_id433:j_id487:j_id491:cmpCaseODC:j_id492:selReqApproval').checked = false;
                return false;
            }
            return false;
        }
    </script>
</apex:component>






 
Hi all,
I written one trigger and test class, but code coverage is 33%. can any one help me

Trigger:-
---------
trigger LeadPreventUpdatePhone on Lead (before update) {         
    string UserName = userinfo.getUserName();
    if(UserName.left(4) == 'sfdc'){
    for (Lead Lead : System.Trigger.new) {   // This line is not covered the code
        Lead oldLead = Trigger.oldMap.get(Lead.ID); // This line is not covered the code
        if(Lead.Phone != oldLead.Phone){ // This line is not covered the code
            Lead.Phone = oldLead.Phone; // This line is not covered the code
        }
    }
    }


Test class:-
--------------
@isTest
public class LeadPreventUpdatePhoneTestClass
{

    @isTest static void LeadPreventUpdatePhone()
    {
       Profile p = [SELECT Id FROM Profile WHERE Name='SumT Support'];
       User u = new User(Alias = 'Test', Email='Test@testorg.com',
       EmailEncodingKey='UTF-8', LastName='Test', LanguageLocaleKey='en_US',
       LocaleSidKey='en_US', ProfileId = p.Id,
       TimeZoneSidKey='America/Los_Angeles', UserName='xsfdc@testorg.com');

       System.runAs(u) {
         // The following code runs as user 'u'
       System.debug('Current User: ' + UserInfo.getUserName());
       System.debug('Current Profile: ' + UserInfo.getProfileId());
    
    
       Lead objLead=new Lead();
       objLead.OwnerId=u.ID;
       objLead.LastName='sampath';
       objLead.Company='Testing';
       objLead.Job_Function__c='VP1';
       objLead.Department__c='HR1!';
       objLead.Lead_Source_Category__c='Partner1';
       objLead.Status='Open';
       objLead.Email='sampath.kumar@octaware.com';
       objLead.phone='515222632';
       insert objLead;
       Lead la = [select phone from Lead where id = :objLead.id limit 1];
       System.debug('Original Lx:'+ la.phone);
       System.assert(la.Phone == '515222632');       
       la.phone = '123456789';
       update la;
      
        Lead lb = [select phone from Lead where id = :objLead.id limit 1];
        System.debug('Changed lb:'+ la.phone);
//COMMENT:  then we assert that the field we updated equals the field it was updated from
        System.assert(la.Phone == '123456789');
        }
      
    }
  }
Hi all,

I have written test class i am getting this error :-  System.QueryException: List has no rows for assignment to SObject

Test Class:-
========

@isTest
public class ContractSubtypeCarrythroughTest{
@isTest static void subtype(){

  ContractSubtypeCarrythroughTest csc = new ContractSubtypeCarrythroughTest();

        Profile p = [select id from profile where name='(TestUser)']; // This line getting error message
        UserRole r = [Select id from userrole where name='(TestUser)'];
     
     Account a = new Account(Name='Test', Type_Platform__c = 'Customer');
        insert a;
Contact con = new Contact(AccountId = a.Id, firstName = 'Test', lastName = 'Test');       
        insert con;       
   

//  UserRole ur = [Select PortalType, PortalAccountId From UserRole where PortalType =:'CustomerPortal' limit 1]; 
 


  User u= new User(alias = 'standt', email='standarduser@testorg.com', emailencodingkey='UTF-8',
                   lastname='Testing', languagelocalekey='en_US', profileid = p.Id,localesidkey='en_US',
                   timezonesidkey='America/Los_Angeles', username='standarduser@testorg.com' );
    insert u;                                 

   Opportunity O = new Opportunity(Name='TestPipeline',CloseDate=System.today(),Type='New Customer',Order_Type__c='New',
            Lead_Source_Category__c='Existing Customer',StageName='Create',Primary_Business_Driver__c='Test');
   insert O;
  
  Custom_Asset__c asset = new Custom_Asset__c(Current_Renewal_Period_Renewal_Type__c = 'TestRenewal', Most_Recent_Closed_Won_Time__c =System.Today(),
                                              Next_Renewal_Period_Renewal_Type__c = 'TestRenewal', End_User__c = 'u.id');
   insert asset;
  
  OpportunityLineItem oli = new OpportunityLineItem(Asset__c = 'asset.id');
  insert oli;                                                
}
}
Hi all,

I written test classes on Batch Apex class it's working fine on sandbox, While i am deploying sandbox to production i am getting below error.
User-added image

Please help me.

Thanks
kumar
Hi all,

I written one trigger and test class getting this error. 
System.TypeException: Invalid id value for this SObject type

Trigger:-
----------

trigger EscalateCase on Escalation__c (after update) {
IF(Trigger.size > 1){return;}
IF(Trigger.new[0].Reason_For_Escalation__c == null || Trigger.new[0].Escalation_Comments__c == null || Trigger.new[0].Escalate_To_Management__c == false || Trigger.new[0].Case__c == null){return;}
Case c = new case(ID = trigger.new[0].Case__c, Escalate_To_Management__c = trigger.new[0].Escalate_To_Management__c, Reason_For_Escalation__c = trigger.new[0].Reason_For_Escalation__c, Escalation_Comments__c = trigger.new[0].Escalation_Comments__c);
update c;
}

Test class:-
--------------

@isTest
private class EscalateCaseTestClass{
@isTest static void Esc(){

Account a = new Account(Name='ContractBookingPeriodProcessingTest',Geography__c='TestGeography',
        Territory_Id__c='TestTerritory',
            Territory_Overlay__c='TestTerritoryOverlay',Renewals_Team__c='TestRenewalsTeam',
            Renewals_Account_Manager__c='TestRenewalsAccountManager');
        insert a;
        Contract c = new Contract(AccountId=a.id,Number_of_Booking_Periods_Records__c = 0, Number_of_Booking_Periods__c = 1,
                                    Status='Create', Finance_Charges__c ='0.5%',
                                    Contract_Term_Start_Date__c=date.valueOf('2013-01-01'),
                                    Contract_Term_End_Date__c=date.valueOf('2099-12-31')                    
                                    );
        insert c;

Case case1 = new case(Id=a.id,Escalate_To_Management__c =true,Reason_For_Escalation__c = 'TestReason' ,Escalation_Comments__c = 'TestEscalation' );
insert case1;

case1.Reason_For_Escalation__c = 'TestReasonForEscalation';
case1.Escalation_Comments__c = 'TestEscalationComments';
update case1;
}
}

Thanks
kumar
Hi all,

I written one test class for Trigger but 0% Code covered.

Trigger:-
---------
trigger OpportunityStageUpdate on Opportunity (after update) {
    List < ID > oid = New List < ID > ();
    for (Opportunity o: Trigger.new) {
        if (o.StageName == 'Closed Lost' && Trigger.oldMap.get(o.Id).StageName != 'Closed Lost') {
            oid.add(o.ID);}
    }
if(oid.size() > 0){
    List < ProfessionalServicesRequest__c> PSRUpdateList= [SELECT Id,Status__c from ProfessionalServicesRequest__c WHERE Opportunity__c in : oid];
    for (ProfessionalServicesRequest__c objPSR: PSRUpdateList) {
        if(objPSR.Status__c =='Request Complete' || objPSR.Status__c =='Request Cancelled'){
         } else {
             objPSR.Status__c = 'Request Cancelled';
              }
    }   update PSRUpdateList;
}}

Test Class:-
--------------

@isTest
private class OpportunityStageUpdateTestclass {
@isTest static void myTest() {
    
// OpportunityStageUpdate os = new OpportunityStageUpdate();
 
        Account a = new Account(Name='Test',Geography__c='TestGeography',Territory_Id__c='TestTerritory',
            Territory_Overlay__c='TestTerritoryOverlay',Renewals_Team__c='TestRenewalsTeam',Renewals_Account_Manager__c='TestRenewalsAccountManager');
        insert a;
        Contact c = new Contact(AccountId=a.id,LastName='Test',Job_Function__c='TestJobFunction',Department__c='TestDepartment');
        insert c;
        Opportunity O = new Opportunity(Name='TestPipelineChange',AccountId=a.id,End_User__c=a.id,   Contact__c=c.id,CloseDate=System.today(),Type='New                            Customer',Order_Type__c='New',  Lead_Source_Category__c='Existing Customer',StageName='Create',Primary_Business_Driver__c='Test');
        insert O;
       ProfessionalServicesRequest__c psr = new ProfessionalServicesRequest__c(Request_Type__c='TestRequest',
           Complexity__c='TestComplex',Completion_By__c=System.Today(),Assigned_To__c='TestAssigned',Status__c='Request Submitted',
           Brief_Descr__c='TestBrief');
      
           insert psr;
           psr.Status__c='Request Cancelled';
          update psr;       
 }}

Thanks in Adv.
kumar
Hi all,
write a test class for extension Controller. 

public with sharing class OpportunityTermSheetCtlr {

public List<Custom_Asset__c> listActiveAssets {get;set;}
public List<OpportunityLineItem> listOpportunityLineItem {get;set;}
public Opportunity o;
public OpportunityTermSheetCtlr(ApexPages.StandardController controller)
{
this.o = (Opportunity) controller.getRecord();

listActiveAssets = [select End_User__c, Product_Name__c, Implementation_Method__c, Production_Version__c, UOM_Quantity__c
                    from Custom_Asset__c where End_User__c = :o.End_User__c AND Active__c = 'Yes'];
  
listOpportunityLineItem = [select OpportunityId, Product_Name__c, QBR_RevenueType__c, UOM_Qty__c, UOM_List_Unit_Price__c, UOM_Net_Unit_Price__c, DiscountPercentTotalUOM__c, TotalPrice
                        from OpportunityLineItem where OpportunityId = :o.id];
                    
}
}

Thanks in adv.
i'm getting this error: Too many query rows: 50001

public without sharing class OpportunityPipelineChangeProcessing {
public static Date TodaysDate = system.today();
    public static void OCP(){
         // Pull in all Open Opportunity records
        Map<Id,Opportunity> mapOpportunity= new Map<Id, Opportunity>
        ([Select Id, CurrencyIsoCode, IsClosed, StageName, CloseDate, Amount, OwnerId, OpportunityPipelineChangeId__c, OpportunityPipelineChanged__c  from Opportunity where IsClosed = False or OpportunityPipelineChanged__c = True]);
       
        // Pull in all prior Pipeline Change records
        Map<Id, Id> mapPC = new Map<Id, Id>();
        Set<Id>     setPC = new Set<Id>();
        for (Opportunity z: mapOpportunity.values()){
            if(z.OpportunityPipelineChangeId__c != Null){
             mapPC.put(z.OpportunityPipelineChangeId__c, z.id);
             setPC.add(z.OpportunityPipelineChangeId__c);  
            }
        }
        Map<Id,OpportunityPipeline_Change__c> mapOpportunityPipeline_Change = new Map<Id, OpportunityPipeline_Change__c>
        ([Select Id, Opportunity__c, Amount_After__c, Amount_Prior__c, Close_Date_After__c, Close_Date_Prior__c, Stage_After__c, Stage_Prior__c, New_Opportunity__c from OpportunityPipeline_Change__c where Id = :setPC]);       

        // Create new OpportunityPipeline Change records
        List<OpportunityPipeline_Change__c> listOpportunityPipelineChangeAdds = new List<OpportunityPipeline_Change__c>();
        for (Opportunity z: mapOpportunity.values()){
            boolean NewOpportunity = True;
            decimal PriorAmountAfter = 0.00;
            string  PriorStageAfter = Null;
            date    PriorCloseDateAfter = Null;
            OpportunityPipeline_Change__c PC = Null;
           
            if(z.OpportunityPipelineChangeId__c != Null){             
                PC = mapOpportunityPipeline_Change.get(z.OpportunityPipelineChangeId__c);
                if(PC != null){
                    NewOpportunity      = False;
                    PriorAmountAfter    = PC.Amount_After__c;
                    PriorStageAfter     = PC.Stage_AFter__c;
                    PriorCloseDateAfter = PC.Close_Date_After__c;
                } else {
                    PriorAmountAfter    = z.Amount;
                    PriorStageAfter     = z.StageName;
                    PriorCloseDateAfter = z.CloseDate;
                }
            } else {
                    PriorAmountAfter    = z.Amount;
                    PriorStageAfter     = z.StageName;
                    PriorCloseDateAfter = z.CloseDate;         
            }      
            listOpportunityPipelineChangeAdds.add(new OpportunityPipeline_Change__c(
                Amount_After__c                 = z.Amount,
                Amount_Prior__c                 = PriorAmountAfter,
                Close_Date_After__c             = z.CloseDate,
                Close_Date_Prior__c             = PriorCloseDateAfter,
                CurrencyIsoCode                 = z.CurrencyIsoCode,
                Effective_Date_Time__c          = TodaysDate,
                EffectiveDateMilliseconds__c    = System.currentTimeMillis(),
                New_Opportunity__c              = NewOpportunity,
                Opportunity__c                  = z.Id,
                Opportunity_Amount__c           = z.Amount,
                Stage_After__c                  = z.StageName,
                Stage_Prior__c                  = PriorStageAfter));
        }
       
        Insert(listOpportunityPipelineChangeAdds);
       
        // Update Opportunities and put in new OpportunityPipelineChange Id and reset OpportunityPipelineChanged__c value to False
        List<Opportunity> listOpportunityUpdates = new List<Opportunity>();
        for (OpportunityPipeline_Change__c z: listOpportunityPipelineChangeAdds){
            listOpportunityUpdates.add(new Opportunity(
                id                             = z.opportunity__c,
                OpportunityPipelineChangeId__c = z.id,
                OpportunityPipelineChanged__c  = false));
        }
        Update(listOpportunityUpdates); 

}
}

Thanks
kumar
Hi all,

Test class error on this line
OpportunityPipeline_Change__c pc = [select Stage_After__c from pportunityPipeline_Change__c where Opportunity__c = :O.Id];
I tried using list and limit.

Thanks
kumar
Hi All,

When i click on picklist(Risk_Assessment__c) i need to display lookup field(Peer_Reviewer__c). i written below code working, but i need lookup lable name only after select the picklist lookup icon need to display otherwise grayout like that not working. i need "Picklist lable: Risk", "Lookup up lable:Peer".

<apex:actionRegion >
 <apex:inputField value="{!thisCon.theCase.Risk_Assessment__c}" required="true" rendered="{!thisCon.caseRTName == 'OD Change'}"> 
    <apex:actionSupport event="onchange" rerender="pr,rp" />     
  </apex:inputField>  
</apex:actionRegion>
  
<apex:pageBlockSectionItem >
 <apex:outputPanel id="rp" >
  <apex:outputText value="Peer Reviewer" rendered="{!if(thisCon.theCase.Risk_Assessment__c != null,true,false)}"/>
 </apex:outputPanel>

<apex:outputPanel id="pr">
  <apex:outputPanel rendered="{!if(thisCon.theCase.Risk_Assessment__c != null,true,false)}">
   <apex:inputField value="{!thisCon.theCase.Peer_Reviewer__c}" rendered="{!thisCon.caseRTName == 'OD Change'}" />
  </apex:outputPanel>
</apex:outputPanel> 
</apex:pageBlockSectionItem>
Hi all,

when i select picklist value lookup field need to edit mode otherwise Grayout the lookup field using Visual force page.

Thanks
Hi all,

Once enter the picklist(Risk Assessment field) value need to edit lookup(Peer Reviewer) field, otherwise greyout lookup field.

-> Req:- Peer Reviewer field cannot be populated until after the Risk Assessment field is populated.

I written Components, Apex class, VF page.

Thanks
Hi,

I have 4 fields

-> 2 fields have lookup to user object.
-> 2 fields have date/time.

but my scenario is when we will enter lookup user at that time need to display current time/date in another field also.

Regards
kumar
Hi all,
I am getting this error when i am executing Test class.
System.AsyncException: The Apex job named already scheduled for execution.

Thanks
Hi all,

I am getting this error when i executing the Batch

ERROR System.LimitException: Apex heap size too large: 13877540

give me any suggestions.

Thanks
Hi all,

I am written one trigger and test class.. Test class code covered 73% i need to increase more.
Trigger:-
trigger UpdatePropertybyGroup on Property__c (after insert, after update) {
    
    Set<Object> Properties = new set<Object>();
    Map< String, Set<Object> > PropertiesPerAccount = new Map< String, Set<Object> >();
    Map< String, Object> AllProperties = new Map<String, Object>();
    Set< String> AllIdsOfproperties = new Set<String>();
    List<Property__c> NeedToUpdateGroupProperties = new List<Property__c>();
     Property__c p1 = Trigger.new[0];
    
    if(   p1.Account__c == '001f000000l10C5' ) {
    for(Property__c p : Trigger.new){
        AllProperties.put( p.Account__c , p);
        AllIdsOfproperties.add(p.Id);
    }
    set<String>AccountIds = AllProperties.keySet();

    for( String account: AccountIds ){
        Properties.clear();
        for( String propAccount :AllProperties.keySet() ) {
            if( AllProperties.containsKey( account ) )
                Properties.add( AllProperties.get( account ) );
        }
        PropertiesPerAccount.put( account , Properties);
    }
    
    List<Property__c> SFDCproperties = [Select Id,name,Account__c,Group_Membership__c from Property__c where Id In :AllIdsOfproperties];
    List<Grouping__c> SFDCGroups     = [Select Id,name,Account__c from Grouping__c where Account__c IN : AccountIds];
    Map<String, String> NewGroupPerAccount = new Map<String, String>();
    set<String> UniqueGroupName = new set<String>();
    List<Grouping__c> groups      = new List<Grouping__c>();
    
    for(Property__c p :SFDCproperties) {
        if( null == p.Group_Membership__c ) {
            if( ! SFDCGroups.isEmpty() ) {
                Boolean IsGroupExists = false;
                for( Grouping__c grp : SFDCGroups ) {
                    if( grp.Name == p.Name ) {
                        IsGroupExists = true;
                        p.Group_Membership__c = grp.Id;  
                        NeedToUpdateGroupProperties.add(p);
                        break;
                    } else {
                        IsGroupExists = false;
                       
                    }
                }
                
                if( false == IsGroupExists ) {
                    if(!UniqueGroupName.contains(p.Name)){
                        Grouping__c g = new Grouping__c();
                        g.Name = p.Name;
                        g.Account__c = p.Account__c;
                        groups.add(g);
                        UniqueGroupName.add(p.Name);
                    }
                }
            } else {
                if(!UniqueGroupName.contains(p.Name)){
                    Grouping__c g = new Grouping__c();
                    g.Name = p.Name;
                    g.Account__c = p.Account__c;
                    groups.add(g);
                    UniqueGroupName.add(p.Name);
                }
            }
        } 
    }
    
    if( !groups.isEmpty() )
        upsert groups;
    
    for(Property__c p :SFDCproperties){
        for(Grouping__c grp : groups){
            if(grp.Name == p.Name){
                p.Group_Membership__c = grp.Id;  
                NeedToUpdateGroupProperties.add(p);
            }
        }
    }
    if( !NeedToUpdateGroupProperties.isEmpty() )
        update NeedToUpdateGroupProperties;
}
}    

Test class:-
@isTest
public class TestUpdatePropertybyGroup {
    @isTest static void updateproperty() {
       
        Account a = new Account(Name ='Test');
        insert a;
        Property__c p = new Property__c(Name ='Testing', Active__c = 'ýes', Price__c =1,Square_Footage__c = 1,Bed_Count__c =1, Bath_Count__c =1, Pet_Policy__c ='No',Lease_Terms__c = 1,Address_Line_1__c = 'Test', City__c ='Test', State__c='Test', Zip_Code__c ='1',Concurrent_Showings_Allowed__c= 'no', Default_Appointment_Length__c ='no', Default_Buffer_Before_Appointments__c ='no');
        insert p;
        Grouping__c g = new Grouping__c(Name = 'Testing');
        insert g;
        
    }
}

Thanks in adv.
 
Hi all,

I don't want to display special character in a field.
suppose i have one field in that field values are : A & B
But I need output  A and B like this.
I created a class but it's not working Please help me.

public class CommonFunctions {
    public void RemovingSpecialCharacters(){
        List<case> listcase = new  List<case>();
        String specialCharacters = '&';
        if(listcase.Notes__c.Contains('/&')){
            listcase.Notes__c = 'And';
            }        
    }
}
Hi all,

I am getting this error: There is an error in XML document (1, 818).

Can you please give me any suggessions.

Thanks
kumar
Hi all,

I am clicking on save button record is not inserting...

VF Page:-
------------

<apex:page standardController="Employee1__c" tabStyle="Employee1__c" extensions="Thirdware">
 <apex:form >
  <apex:pageBlock id="first">
   <apex:pageblockSection title="First Page">
    <apex:inputfield value="{!Employee1__c.FirstName__c}" />
    <apex:inputfield value="{!Employee1__c.LastName__c}" />
   </apex:pageblockSection>
 
   <apex:outputPanel id="second">
   <apex:outputPanel rendered="{!show}">
   <apex:pageBlockSection title="Second page">
   
    <apex:inputfield value="{!Employee1__c.Employee2__c}" />
    <apex:inputfield value="{!Employee1__c.Picklist__c}" /> 
    <apex:commandButton value="Approved" />
    <apex:commandButton value="Rejected" /> 
    </apex:pageBlockSection>
    </apex:outputPanel>   
    </apex:outputPanel>
 
 <apex:pageBlockButtons location="Bottom">
  <apex:actionRegion >
   <apex:commandButton value="Save" action="{!savedata}">
   <apex:actionSupport reRender="second" event="onchange"/>
   </apex:commandButton>
   </apex:actionRegion>
  </apex:pageBlockButtons>
  </apex:pageBlock>
 </apex:form>
</apex:page>


Apex class:-
----------------
public with sharing class Thirdware {

    public Boolean show{get;set;}
    public string LastName{set;get;}
    public string FirstName{set;get;} 
    public Employee1__c emp {set;get;} 
    
    public Thirdware(ApexPages.StandardController controller) {
     show = false;
    }    
    
    public void savedata(){
     emp = new Employee1__c();
     emp.FirstName__c = FirstName;
     emp.LastName__c = LastName;
     try{
     insert emp;
    }catch(Exception e){
   }
   }
    public boolean Save(){
    
     show = true;
     return null;
    }    
}


Regards
Sam
Hi All,

I created one component, Field(Request_Managerial_Approval__c) This field is not working properly.

Problem:- when i select field(Peer_Reviewer__c) i need to visible this Field(Request_Managerial_Approval__c) it's working fine.

But when i select field(Peer_Reviewer__c) and click on save(means i am not enter any value of this Field(Request_Managerial_Approval__c),. after reopen the record this Field(Request_Managerial_Approval__c) is disabling.
i need to enable when i reopen or when i enter the value (Peer_Reviewer__c).

<apex:component id="cmpCaseODC" allowDML="true">
   
 <apex:attribute name="thisCon" type="NewCase" required="true" description="controller passed from parent" />
  <apex:pageBlockSection title="Contact Information" collapsible="false">

    <apex:outputField value="{!thisCon.theCase.OwnerId}"/>
    <apex:pageBlockSectionItem >
      <apex:outputLabel value="Case Record Type" />
      <apex:outputText value="{!thisCon.caseRTName}" />
    </apex:pageBlockSectionItem>

    <apex:outputField value="{!thisCon.theCase.CaseNumber}"/>
    <apex:inputField value="{!thisCon.theCase.ParentId}"/>
    <apex:outputField value="{!thisCon.theCase.AccountId}"/>
       
 <apex:outputField value="{!thisCon.theCase.Entitlement__c}"/>
 <apex:outputField value="{!thisCon.theCase.ContactId}"/>
    <apex:outputField value="{!thisCon.theAsset.Support_Entitlement__r.Contract_Security_Restrictions__c}"/>
    <apex:outputField rendered="{!NOT(thisCon.isEUCase)}" value="{!thisCon.theCaseContact.Email}"/>
     <apex:outputField value="{!thisCon.theCase.Support_Level_formula__c}"/>
     
    <apex:outputField rendered="{!NOT(thisCon.isEUCase)}" value="{!thisCon.theCaseContact.Phone}"/>
     
     <apex:inputField value="{!thisCon.theCase.Customer_Reference_Number__c}"/>
     

    <apex:inputField value="{!thisCon.theCase.Internal_Contact_Name__c}"/>
     <apex:outputField value="{!thisCon.theCase.Reporting_Office__c}"/>
    

    <apex:pageBlockSectionItem >
      <apex:outputLabel value="Internal Department" />
      <apex:outputText value="{!thisCon.internalContactDepartment}"/>
    </apex:pageBlockSectionItem>
       
    
    <apex:inputField value="{!thisCon.theCase.Performance_Governance_Case__c}" />
    <apex:inputField value="{!thisCon.theCase.Reason_for_Referral__c}" />
    <apex:inputField value="{!thisCon.theCase.Sent_Survey__c}" />
    <apex:inputField value="{!thisCon.theCase.Approval_Status__c}" />    
    <apex:inputField id="selReqApproval" value="{!thisCon.theCase.Request_Approval__c}" /> 
    
    <apex:inputField id="am" onblur="setRequestApproval(this);" value="{!thisCon.theCase.Approving_Manager__c}" rendered="{!thisCon.caseRTName == 'OD Change'}" id="am" />
        
    <apex:outputField value="{!thisCon.theCase.Approving_Manager_Date__c}"  rendered="{!thisCon.caseRTName == 'OD Change'}" />
    <apex:pageBlockSectionItem >
    <apex:outputLabel value="Risk Assessment" rendered="{!thisCon.caseRTName == 'OD Change'}"></apex:outputLabel>
    <apex:actionRegion >
    
            
    <apex:inputField onblur="setManagerialApprovalRisk(this);" id="selRisk" value="{!thisCon.theCase.Risk_Assessment__c}" rendered="{!thisCon.caseRTName == 'OD Change'}"> 
     <apex:actionSupport event="onchange" rerender="pr,prr" />      
    </apex:inputField>
    </apex:actionRegion>
    </apex:pageBlockSectionItem>
  
   <apex:pageBlockSectionItem >
   <apex:outputLabel value="Peer Reviewer" rendered="{!thisCon.caseRTName == 'OD Change'}"></apex:outputLabel>
   <apex:outputPanel id="pr"> 
   
   <apex:outputPanel rendered="{!if(thisCon.theCase.Risk_Assessment__c != null,true,false)}">  
   <apex:inputField onblur="return setManagerialApproval(this);" value="{!thisCon.theCase.Peer_Reviewer__c}" rendered="{!thisCon.caseRTName == 'OD Change'}" >
   </apex:inputField>
   </apex:outputPanel>
   
   </apex:outputPanel> 
   </apex:pageBlockSectionItem>

    <apex:inputField id="chkManageApprove" value="{!thisCon.theCase.Request_Managerial_Approval__c}" rendered="{!thisCon.caseRTName == 'OD Change'}"/>

    <apex:outputField value="{!thisCon.theCase.Peer_Reviewer_Date__c}"  rendered="{!thisCon.caseRTName == 'OD Change'}" />
    <apex:inputField value="{!thisCon.theCase.SOP_Referenced__c}" rendered="{!thisCon.caseRTName == 'OD Change'}" required="true"/> 
    <apex:inputField value="{!thisCon.theCase.SOP_Version__c}" rendered="{!thisCon.caseRTName == 'OD Change'}" required="true"/> 
   

   </apex:pageBlockSection>
  <script>

        document.getElementById('j_id0:j_id6:j_id432:j_id433:j_id487:j_id491:cmpCaseODC:j_id492:chkManageApprove').disabled = true;
        if(document.getElementById('j_id0:j_id6:j_id432:j_id433:j_id487:j_id491:cmpCaseODC:j_id492:am') != null){
            if(document.getElementById('j_id0:j_id6:j_id432:j_id433:j_id487:j_id491:cmpCaseODC:j_id492:am').value != ''){
                document.getElementById('j_id0:j_id6:j_id432:j_id433:j_id487:j_id491:cmpCaseODC:j_id492:selReqApproval').disabled = false;
            }else{
                document.getElementById('j_id0:j_id6:j_id432:j_id433:j_id487:j_id491:cmpCaseODC:j_id492:selReqApproval').disabled = true;
            }
        
        }
        function setManagerialApproval(lkp){

            if(lkp.value != ''){
                document.getElementById('j_id0:j_id6:j_id432:j_id433:j_id487:j_id491:cmpCaseODC:j_id492:chkManageApprove').disabled = false;
                return false;
            }else{
                document.getElementById('j_id0:j_id6:j_id432:j_id433:j_id487:j_id491:cmpCaseODC:j_id492:chkManageApprove').disabled = true;
                document.getElementById('j_id0:j_id6:j_id432:j_id433:j_id487:j_id491:cmpCaseODC:j_id492:chkManageApprove').checked = false;
                return false;
            }
            return false;
        }
        function setManagerialApprovalRisk(selList){

            if(selList.value == ''){
                document.getElementById('j_id0:j_id6:j_id432:j_id433:j_id487:j_id491:cmpCaseODC:j_id492:chkManageApprove').disabled = true;
                document.getElementById('j_id0:j_id6:j_id432:j_id433:j_id487:j_id491:cmpCaseODC:j_id492:chkManageApprove').checked = false;
                return false;
            }
            return true;
        
        }
        function setRequestApproval(lkp){

            if(lkp.value != ''){
                document.getElementById('j_id0:j_id6:j_id432:j_id433:j_id487:j_id491:cmpCaseODC:j_id492:selReqApproval').disabled = false;
                return false;
            }else{
                document.getElementById('j_id0:j_id6:j_id432:j_id433:j_id487:j_id491:cmpCaseODC:j_id492:selReqApproval').disabled = true;
                document.getElementById('j_id0:j_id6:j_id432:j_id433:j_id487:j_id491:cmpCaseODC:j_id492:selReqApproval').checked = false;
                return false;
            }
            return false;
        }
    </script>
</apex:component>






 

 

Hi All,

 

It is in global class. testcoverage is 18% now. Here only first start method is under coverage. I have 7 methods in execute method.

 

 Webservice static void execute()
    {
    ScheduleJob_UpdateOpportunityInit.start();
    ScheduleJob_UpdateOpportunityInit.start2();
    ScheduleJob_UpdateOpportunityInit.start3();

}

 

@istest
private class Scheduledjob_test{
public static testMethod void Scheduledjobs()
{
Test.StartTest();
try{StartScheduledTasks.execute();     }
catch(Exception e7){System.debug('An Exception has Occured: '+e7);}
Test.stopTest();
}
}

 

 

need help...............Thanks in advance.