0

I want to particular value from Custom Setting. When i Click on Checkbox i want that Custom setting Value only.Custom Setting is List Type

<apex:page Controller="ServiceTableCtrl" sidebar="false" showHeader="false">
<apex:form >
<apex:pageblock >
    <apex:pageBlockSection columns="1" title="Select Services below:" >

        <apex:pageblockTable value="{!wrapserviceList}" var="s">
        <apex:column >
            <apex:inputCheckbox value="{!s.selected}"/>
        </apex:column>       
        <apex:column value="{!s.Index}" headerValue="Sr.No"/>
         <apex:column value="{!s.service.Service__c}"/>
         <apex:column headerValue="Time" >
            <apex:inputText value="{!s.service.Time__c}" disabled="{!if(s.service.Time__c != null,true,false)}"  />
         </apex:column>
         <apex:column headerValue="Price" >
             <apex:inputText value="{!s.service.Price__c}" disabled="{!if(s.service.Price__c != null,true,false)}" />
         </apex:column>   
    </apex:pageblockTable>

          <center> 
          <apex:outputPanel >
          <apex:outputLabel >Select Service Type: </apex:outputLabel>
            <apex:selectList title="Select Service Type" value="{!ServiceType}" multiselect="false" size="1">
                <apex:selectOption itemValue="Preparing showroom" itemLabel="Preparing showroom"/>
                <apex:selectOption itemValue="Customer delivery" itemLabel="Customer delivery"/>
            </apex:selectList>
          </apex:outputPanel>
          </center>

    </apex:pageblockSection>
    <apex:pageBlockButtons location="Bottom" >
        <apex:commandButton value="Submit" action="{!submit}" onclick="window.close();" />
        <apex:commandButton value="Cancel" onclick="window.close();"/>
    </apex:pageBlockButtons>
</apex:pageblock>
</apex:form>
</apex:page>

Controller

public with sharing class ServiceTableCtrl {

    public String ServiceType { get; set; }

    public List<Showroom_Cleaning_Service__c> showroomservicelist {get;set;}
    public List<WrapperService> wrapserviceList {get;set;}
    public List<WrapperService> wrapservice{get;set;}
    public Integer opget{get;set;}
    public String Subject = 'Prepare Cleaning';
    public String Status = 'Not Started';
    public String Priority = 'Normal';
    public String Description = 'Prepare Vehicle';
    public Integer Reminder = 0;
    public Boolean IsReminder = false;
    public Id TaskOwnerId;
    public Id VehId;

    public ServiceTableCtrl ()
    {
        this.Vehid = ApexPages.currentPage().getParameters().get('id');
        showroomservicelist =new List<Showroom_Cleaning_Service__c>();
        showroomservicelist =Showroom_Cleaning_Service__c.getall().values();

         wrapserviceList =new List<WrapperService>(); 
         Integer i=1;
        for(Showroom_Cleaning_Service__c s:showroomservicelist)
        {
            WrapperService w=new WrapperService(i,s);
            wrapserviceList.add(w);
            i++;
        }

    }

    public Void Submit()
    {
            // Creating Task for the preparer
         TaskOwnerId = [Select ownerId from dealer__Vehicle_Inventory__c where id =: VehId limit 1].ownerId;
         Subject = ServiceType;
         //TaskUtility.createTask(Subject, VehId , Status, Priority, Description, IsReminder, Reminder, TaskOwnerId);
         //createEvent(String Subject, Id ObjectId, String Description, Boolean IsReminder, Integer Reminder, DateTime EventDateTime, Integer Duration, Id OwnerId)

         showroomservicelist =new List<Showroom_Cleaning_Service__c>();
         showroomservicelist =Showroom_Cleaning_Service__c.getall().values();      

    }


    public Class WrapperService
    {
        public Integer index{get;set;}
        public Showroom_Cleaning_Service__c service{get;set;}
        public Boolean Selected{get;set;}

        public WrapperService(Integer i,Showroom_Cleaning_Service__c s)
        {
            this.Index=i;
            this.service=s;   
        }

    }

}
  • Are you getting any error or you don't know how to fetch value from custom setting? – Tushar Sharma Nov 18 '15 at 6:30
  • I didn't get Any error but i don't know how to get Specific value of Custom setting.. – Shantanu Mahajan Nov 18 '15 at 6:35
  • set what and where? May you rephrase? As far as I understand when you check checkbox you want to set one of variable to value from custom setting? – Artur Kępczyński Nov 18 '15 at 6:39
  • @ArturKępczyński:When I Check Checkbox i want that record should be Displayed. – Shantanu Mahajan Nov 18 '15 at 6:41
0

Ok, let me start with this:

  • first of all if you want to see changes in in Table you need to either rerender it or use JavaScript to reflect it. Use <apex:actionSupport.. /> within Checkbox to rerender table and call action in controller that will set proper value.
  • please check "Submit" button. I am not able to test it myself but "onclick" is invoked before methode defined in "action" and it may potentially break something.
  • Submit should return PageReference.
  • remove "i"
  • most of yours variables may be replaced by proper "Task" object(its better than having lot of variables)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.