• Karthikeyan Kannan
  • NEWBIE
  • 10 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 8
    Replies
I am Updating Some fields in a SiteContracts__c Object from Engineer_Checklist__c object , while performing this Operation getting the Above mentioned Error, Can any one suggest me where should I Specify the ID and How ?

Here is my Code:

public List<id> sitecontractids = new List<id>();
public List<Engineer_Checklist__c> ssnewList = new List<Engineer_Checklist__c>();
public List<SiteContracts__c> scnewlist = new List<SiteContracts__c>();
public List<SiteContracts__c> scList =[SELECT id, name From SiteContracts__c LIMIT 200];

for(SiteContracts__c scnewid :scList ){
         sitecontractids.add(scnewid.id);
   }

  ssnewList =[Select Id, X6L_Water_Qty__c, X9L_Water_Qty__c, X3L_Water_Mist_Qty__c, X6L_Water_Mist_Qty__c, X9L_Water_Mist_Qty__c
                                      From Engineer_Checklist__c
                                                  Where Fire_Extinguisher_Service_complete__c=true AND Site_Contract__c !=NULL AND
                                                                   Site_Contract__c IN :sitecontractids  Order By lastmodifieddate desc LIMIT 200];

for(Engineer_Checklist__c ssli:ssnewList)
{
    SiteContracts__c newsc = new SiteContracts__c();

newsc.X6L_Water__c=ssli.X6L_Water_Qty__c;
newsc.X9L_Water__c=ssli.X9L_Water_Qty__c;
newsc.X3L_Water_Mist__c=ssli.X3L_Water_Mist_Qty__c;
newsc.X6L_Water_Mist__c=ssli.X6L_Water_Mist_Qty__c;
newsc.X9L_Water_Mist__c=ssli.X9L_Water_Mist_Qty__c;

scnewlist.add(newsc);
}
update scnewlist;
Hi ,
      I have a Inline Section and it has Start Date AND End date row with multiple column, Now I want to delete the Column if The End Date is Passed, Can any one help me how to achieve this with the Scheduler class.?
Hi ,
     I am getting this Error while saving my VF page can anyone tel where I did the mistake and here is my code. Thanks in Advance.

=======PAGE======
<apex:page controller="InlineTechnicianController" id="mypage" sidebar="false">
    <apex:form id="form1" >
    <apex:pageBlock id="pgBlok" rendered="{!isSaved}">
  <apex:pageblockButtons location="top">
  <apex:commandButton value="Edit Dates" action="{!editTechDate}" reRender="form1"/>
      </apex:pageblockButtons>
         <apex:pageBlockSection columns="1">
                <apex:pageBlockTable value="{!Technician}" var="tc">

                    <apex:column headerValue="StartDate"><apex:outputText value="{!tc.StartDate}" ></apex:outputText></apex:column>
                    <apex:column headerValue="EndDate"><apex:outputText value="{!tc.EndDate}"></apex:outputText></apex:column>
                                      
                </apex:pageBlockTable>
         </apex:pageBlockSection>
       
      </apex:pageBlock>
    <apex:pageBlock id="pgBlok1" rendered="{!isEdit}">
  <apex:pageblockButtons location="top">
    <apex:commandButton value="Add Row" action="{!addTechDate}" reRender="form1"/>
    <apex:commandButton value="Save Row" action="{!saveTechDate}" reRender="form1"/>
   <!-- <apex:commandButton value="Remove Additional Row" action="{!Datesremove}" reRender="pgBlok"/> -->
  </apex:pageblockButtons>
         <apex:pageBlockSection columns="1">
                <apex:pageBlockTable value="{!Technician}" var="tc">

                    <apex:column headerValue="StartDate"><apex:inputText value="{!tc.StartDate}" size="10" id="demo" onfocus="DatePicker.pickDate(false, this , false);"></apex:inputText></apex:column>
                    <apex:column headerValue="EndDate"><apex:inputText value="{!tc.EndDate}" size="10" id="demo1" onfocus="DatePicker.pickDate(false, this , false);"></apex:inputText></apex:column>
                    <apex:column >
                           <apex:commandLink action="{!doRemove}" value="Remove Row" reRender="form1">
                           <apex:param name="removeRow" value="{!tc.Technician}" />
                           </apex:commandLink>
                   </apex:column>
                   
                </apex:pageBlockTable>
         </apex:pageBlockSection>
       
      </apex:pageBlock>  
      
    </apex:form>
</apex:page>

======CONTROLLER=======
public class InlineTechnicianController
{
//Globally Declared Variables and Properties.
  
    public boolean isEdit {get;set;}
    public boolean flag {get;set;}
    public boolean isSaved {get;set;}
    public Integer rowNum {get;set;}

//Constructor
public InlineTechnicianController() {
            isSaved = true;
    }  
public InlineTechnicianController(ApexPages.StandardController controller)
    {
        flag=false;
        isEdit=false;
        isSaved = true;
}

//Wrapper Classes
public class TechnicianWrapper
    {
        public String StartDate{get;set;}
        public String EndDate{get;set;}
       
}    
  
    //Methods
      Engineer__c newList= [select Id,Start_Date_Long__c,End_Date_Long__c from Engineer__c where Id=:ApexPages.currentPage().getParameters().get('id')];
  
      public List<TechnicianWrapper> techList = new List<TechnicianWrapper>();
  
      public List<TechnicianWrapper> getTechnician()  // For populating Dates
    {   
       
        if(techList.isEmpty())//Avoids list getting repopulated with same Values over and over again.
        {         
          if(newList.Start_Date_Long__c!=null)// Only if fields from which the data is getting filled are populated.
            {
                List<String> sdate,edate;
                sdate= newList.Start_Date_Long__c.split(';',-1);                                      
                for(Integer iterator=0;iterator<sdate.size();iterator++)
                {
                    TechnicianWrapper instance = new TechnicianWrapper();
                    instance.StartDate = sdate[iterator];
                   
                    if(newList.End_Date_Long__c!=null )
                    {
                    instance.EndDate = edate[iterator];
                    }else
                    {
                    instance.EndDate ='';
                    }
                                    
                   techList.add(instance);   
                   System.debug('techList====='+techList); 
                }
            }
        }
        System.debug('techList====='+techList);
        return techList;
       
    }
    public PageReference editTechDate()
    {
        isEdit=true;
        isSaved = false;
        return null;
    }
    public PageReference addTechDate()
    {
       
       TechnicianWrapper instance = new TechnicianWrapper();
       techList.add(instance);
       return null;   
    }
    public PageReference saveTechDate()
    {
   
        Boolean isError=false;
        Boolean isError2=false;
        Boolean isError3=false;
        Boolean isError4=false;
        Boolean isError5=false;
       
        String sdt='', edt='';
      
       
        if(flag)
        {
          techList = new List<TechnicianWrapper>();
        }
       // Set<String> avoidDuplicate =  new Set<String>();
       
        for(TechnicianWrapper iterator:techList)
        { 
                      
         
            if(sdt=='')
            {
                sdt = iterator.StartDate;
                edt = iterator.EndDate;
               
            }
            else
            {
                sdt = sdt+';'+iterator.StartDate;
                edt = edt+';'+iterator.EndDate;
               
            }
            // avoidDuplicate.add(iterator.systemType);
   
             if(iterator.startDate=='')
             {
                isError3 = true;
            }
            
            if(iterator.StartDate!='' && iterator.EndDate=='')
            {
                isError4 = true;
            }
             if(iterator.StartDate=='' && iterator.EndDate!='')
            {
                isError5 = true;
            }
           
        }
        /*
         if(techList.size()!=avoidDuplicate.size())
            {
            isError2 = true;
            }
            */
           
         Engineer__c newList= [select Id,Start_Date_Long__c,End_Date_Long__c from Engineer__c
                            where Id=:ApexPages.currentPage().getParameters().get('id')];
       
         newList.Start_Date_Long__c = sdt;
         newList.End_Date_Long__c = edt;
      
       
         if(isError)
        {
            ApexPages.Message myMsg=new ApexPages.Message(ApexPages.Severity.Error, 'Pass and Fail cannot be selected at the same time.');
            ApexPages.addMessage(myMsg);
        }
        else if(isError3)
        {
            ApexPages.Message myMsg=new ApexPages.Message(ApexPages.Severity.Error, 'Cannot save without Start & End Dates. ');
            ApexPages.addMessage(myMsg);
        }
        else if(isError4)
        {
            ApexPages.Message myMsg=new ApexPages.Message(ApexPages.Severity.Error, 'Cannot save without End Date');
            ApexPages.addMessage(myMsg);
        }
         else if(isError5)
        {
            ApexPages.Message myMsg=new ApexPages.Message(ApexPages.Severity.Error, 'Cannot save without Start Date');
            ApexPages.addMessage(myMsg);
        }
        else
        {
       
        //try{
                        
                update newList;
               
                Engineer__c newList2= [select Id,Start_Date_Long__c,End_Date_Long__c from Engineer__c
                        where Id=:ApexPages.currentPage().getParameters().get('id') limit 1];
        /*}catch(exception e){
            ApexPages.Message myMsg=new ApexPages.Message(ApexPages.Severity.Error, e.getMessage());
            ApexPages.addMessage(myMsg);   
        }*/
        isEdit=false;
        isSaved = true;
    }
    return null;
    }
  
   Public PageReference doRemove()
    {
        rowNum = Integer.valueOf(apexpages.currentpage().getparameters().get('index'));
        techList.remove(rowNum);
        return null;
     }
       
}
Hi,

I want to add  Row's with Dates and with  Date Picker.
I have a VF page where in I am using  standard controller.
The first time when the page is displayed 2 input fields are there i.e. StartDate and EndDate.

Now, I want to implement the functionality wherein if a user clicks on Add Row button,  1more row will appear to enter a value in both  the fields(StartDate and EndDate.). So, if he clicks the button 5 times, 5 rows shud appear with thses two columns.
After providing the inputs, he will click on "Save " button, and the record should be saved wherein the inputs provided in multiple rows should be saved into the related list of the  detail Section (The Section will contain the information like StartDate and EndDate).
Request you to please forward me the code for the above mentioned functionality. Since its an urgent requirement. An early reply will be highly appreciated.

Thanks.
I am Updating Some fields in a SiteContracts__c Object from Engineer_Checklist__c object , while performing this Operation getting the Above mentioned Error, Can any one suggest me where should I Specify the ID and How ?

Here is my Code:

public List<id> sitecontractids = new List<id>();
public List<Engineer_Checklist__c> ssnewList = new List<Engineer_Checklist__c>();
public List<SiteContracts__c> scnewlist = new List<SiteContracts__c>();
public List<SiteContracts__c> scList =[SELECT id, name From SiteContracts__c LIMIT 200];

for(SiteContracts__c scnewid :scList ){
         sitecontractids.add(scnewid.id);
   }

  ssnewList =[Select Id, X6L_Water_Qty__c, X9L_Water_Qty__c, X3L_Water_Mist_Qty__c, X6L_Water_Mist_Qty__c, X9L_Water_Mist_Qty__c
                                      From Engineer_Checklist__c
                                                  Where Fire_Extinguisher_Service_complete__c=true AND Site_Contract__c !=NULL AND
                                                                   Site_Contract__c IN :sitecontractids  Order By lastmodifieddate desc LIMIT 200];

for(Engineer_Checklist__c ssli:ssnewList)
{
    SiteContracts__c newsc = new SiteContracts__c();

newsc.X6L_Water__c=ssli.X6L_Water_Qty__c;
newsc.X9L_Water__c=ssli.X9L_Water_Qty__c;
newsc.X3L_Water_Mist__c=ssli.X3L_Water_Mist_Qty__c;
newsc.X6L_Water_Mist__c=ssli.X6L_Water_Mist_Qty__c;
newsc.X9L_Water_Mist__c=ssli.X9L_Water_Mist_Qty__c;

scnewlist.add(newsc);
}
update scnewlist;
Hi ,
      I have a Inline Section and it has Start Date AND End date row with multiple column, Now I want to delete the Column if The End Date is Passed, Can any one help me how to achieve this with the Scheduler class.?
Hi ,
     I am getting this Error while saving my VF page can anyone tel where I did the mistake and here is my code. Thanks in Advance.

=======PAGE======
<apex:page controller="InlineTechnicianController" id="mypage" sidebar="false">
    <apex:form id="form1" >
    <apex:pageBlock id="pgBlok" rendered="{!isSaved}">
  <apex:pageblockButtons location="top">
  <apex:commandButton value="Edit Dates" action="{!editTechDate}" reRender="form1"/>
      </apex:pageblockButtons>
         <apex:pageBlockSection columns="1">
                <apex:pageBlockTable value="{!Technician}" var="tc">

                    <apex:column headerValue="StartDate"><apex:outputText value="{!tc.StartDate}" ></apex:outputText></apex:column>
                    <apex:column headerValue="EndDate"><apex:outputText value="{!tc.EndDate}"></apex:outputText></apex:column>
                                      
                </apex:pageBlockTable>
         </apex:pageBlockSection>
       
      </apex:pageBlock>
    <apex:pageBlock id="pgBlok1" rendered="{!isEdit}">
  <apex:pageblockButtons location="top">
    <apex:commandButton value="Add Row" action="{!addTechDate}" reRender="form1"/>
    <apex:commandButton value="Save Row" action="{!saveTechDate}" reRender="form1"/>
   <!-- <apex:commandButton value="Remove Additional Row" action="{!Datesremove}" reRender="pgBlok"/> -->
  </apex:pageblockButtons>
         <apex:pageBlockSection columns="1">
                <apex:pageBlockTable value="{!Technician}" var="tc">

                    <apex:column headerValue="StartDate"><apex:inputText value="{!tc.StartDate}" size="10" id="demo" onfocus="DatePicker.pickDate(false, this , false);"></apex:inputText></apex:column>
                    <apex:column headerValue="EndDate"><apex:inputText value="{!tc.EndDate}" size="10" id="demo1" onfocus="DatePicker.pickDate(false, this , false);"></apex:inputText></apex:column>
                    <apex:column >
                           <apex:commandLink action="{!doRemove}" value="Remove Row" reRender="form1">
                           <apex:param name="removeRow" value="{!tc.Technician}" />
                           </apex:commandLink>
                   </apex:column>
                   
                </apex:pageBlockTable>
         </apex:pageBlockSection>
       
      </apex:pageBlock>  
      
    </apex:form>
</apex:page>

======CONTROLLER=======
public class InlineTechnicianController
{
//Globally Declared Variables and Properties.
  
    public boolean isEdit {get;set;}
    public boolean flag {get;set;}
    public boolean isSaved {get;set;}
    public Integer rowNum {get;set;}

//Constructor
public InlineTechnicianController() {
            isSaved = true;
    }  
public InlineTechnicianController(ApexPages.StandardController controller)
    {
        flag=false;
        isEdit=false;
        isSaved = true;
}

//Wrapper Classes
public class TechnicianWrapper
    {
        public String StartDate{get;set;}
        public String EndDate{get;set;}
       
}    
  
    //Methods
      Engineer__c newList= [select Id,Start_Date_Long__c,End_Date_Long__c from Engineer__c where Id=:ApexPages.currentPage().getParameters().get('id')];
  
      public List<TechnicianWrapper> techList = new List<TechnicianWrapper>();
  
      public List<TechnicianWrapper> getTechnician()  // For populating Dates
    {   
       
        if(techList.isEmpty())//Avoids list getting repopulated with same Values over and over again.
        {         
          if(newList.Start_Date_Long__c!=null)// Only if fields from which the data is getting filled are populated.
            {
                List<String> sdate,edate;
                sdate= newList.Start_Date_Long__c.split(';',-1);                                      
                for(Integer iterator=0;iterator<sdate.size();iterator++)
                {
                    TechnicianWrapper instance = new TechnicianWrapper();
                    instance.StartDate = sdate[iterator];
                   
                    if(newList.End_Date_Long__c!=null )
                    {
                    instance.EndDate = edate[iterator];
                    }else
                    {
                    instance.EndDate ='';
                    }
                                    
                   techList.add(instance);   
                   System.debug('techList====='+techList); 
                }
            }
        }
        System.debug('techList====='+techList);
        return techList;
       
    }
    public PageReference editTechDate()
    {
        isEdit=true;
        isSaved = false;
        return null;
    }
    public PageReference addTechDate()
    {
       
       TechnicianWrapper instance = new TechnicianWrapper();
       techList.add(instance);
       return null;   
    }
    public PageReference saveTechDate()
    {
   
        Boolean isError=false;
        Boolean isError2=false;
        Boolean isError3=false;
        Boolean isError4=false;
        Boolean isError5=false;
       
        String sdt='', edt='';
      
       
        if(flag)
        {
          techList = new List<TechnicianWrapper>();
        }
       // Set<String> avoidDuplicate =  new Set<String>();
       
        for(TechnicianWrapper iterator:techList)
        { 
                      
         
            if(sdt=='')
            {
                sdt = iterator.StartDate;
                edt = iterator.EndDate;
               
            }
            else
            {
                sdt = sdt+';'+iterator.StartDate;
                edt = edt+';'+iterator.EndDate;
               
            }
            // avoidDuplicate.add(iterator.systemType);
   
             if(iterator.startDate=='')
             {
                isError3 = true;
            }
            
            if(iterator.StartDate!='' && iterator.EndDate=='')
            {
                isError4 = true;
            }
             if(iterator.StartDate=='' && iterator.EndDate!='')
            {
                isError5 = true;
            }
           
        }
        /*
         if(techList.size()!=avoidDuplicate.size())
            {
            isError2 = true;
            }
            */
           
         Engineer__c newList= [select Id,Start_Date_Long__c,End_Date_Long__c from Engineer__c
                            where Id=:ApexPages.currentPage().getParameters().get('id')];
       
         newList.Start_Date_Long__c = sdt;
         newList.End_Date_Long__c = edt;
      
       
         if(isError)
        {
            ApexPages.Message myMsg=new ApexPages.Message(ApexPages.Severity.Error, 'Pass and Fail cannot be selected at the same time.');
            ApexPages.addMessage(myMsg);
        }
        else if(isError3)
        {
            ApexPages.Message myMsg=new ApexPages.Message(ApexPages.Severity.Error, 'Cannot save without Start & End Dates. ');
            ApexPages.addMessage(myMsg);
        }
        else if(isError4)
        {
            ApexPages.Message myMsg=new ApexPages.Message(ApexPages.Severity.Error, 'Cannot save without End Date');
            ApexPages.addMessage(myMsg);
        }
         else if(isError5)
        {
            ApexPages.Message myMsg=new ApexPages.Message(ApexPages.Severity.Error, 'Cannot save without Start Date');
            ApexPages.addMessage(myMsg);
        }
        else
        {
       
        //try{
                        
                update newList;
               
                Engineer__c newList2= [select Id,Start_Date_Long__c,End_Date_Long__c from Engineer__c
                        where Id=:ApexPages.currentPage().getParameters().get('id') limit 1];
        /*}catch(exception e){
            ApexPages.Message myMsg=new ApexPages.Message(ApexPages.Severity.Error, e.getMessage());
            ApexPages.addMessage(myMsg);   
        }*/
        isEdit=false;
        isSaved = true;
    }
    return null;
    }
  
   Public PageReference doRemove()
    {
        rowNum = Integer.valueOf(apexpages.currentpage().getparameters().get('index'));
        techList.remove(rowNum);
        return null;
     }
       
}
Hi,

I want to add  Row's with Dates and with  Date Picker.
I have a VF page where in I am using  standard controller.
The first time when the page is displayed 2 input fields are there i.e. StartDate and EndDate.

Now, I want to implement the functionality wherein if a user clicks on Add Row button,  1more row will appear to enter a value in both  the fields(StartDate and EndDate.). So, if he clicks the button 5 times, 5 rows shud appear with thses two columns.
After providing the inputs, he will click on "Save " button, and the record should be saved wherein the inputs provided in multiple rows should be saved into the related list of the  detail Section (The Section will contain the information like StartDate and EndDate).
Request you to please forward me the code for the above mentioned functionality. Since its an urgent requirement. An early reply will be highly appreciated.

Thanks.

Hi,

I need to put a custom related list on the account detail page and put the Hover link on the top of the page for the custom related list.

 

I was able to do the custom related list displayed on the bottom of the Account detail page wiring a standard controller extension and visula force page.

 

Now the problem is How do I place the Hover link on the top of the page for the custom list? I saw couple of threads for the above, but the hover links issue was never discussed?.

 

Can any one please guide me how can I do this.

 

Thank you.