• Chittineni Sandeep
  • NEWBIE
  • 30 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 4
    Replies
public void Save()
    {        
       insert pat;            
        for(wrapperservay wl : wrp)
        {                                                                                    
            Answer__c ua = new Answer__c();       //From here code is not covered.      
            ua.Name = wl.Name;
             ua.Questionn__c = wl.QuestionId;                  
            useranswers.add(ua);
           insert ua;                       
            pat=new Answer__c();                                              
        }


Please help guys from this problem


Thanks in Advance,

Sandeep

Apex Code------------------------
public class questions {
    
     public list<Questionn__c> questions{get;set;}
    public map<string,list<SelectOption>> options{set;get;}
      Public List<wrapperservay> wrp{get;set;} 
    
    public list<Answer__c> useranswers  = new list<Answer__c>();
    public Answer__c pat;
    

    public Answer__c getpat(){
        return pat;
    }   
    public questions()
    {
        options=new map<string,list<SelectOption>>();
         pat= new Answer__c(); 
          
        questions = new list<Questionn__c>();
        
         wrp = new List<wrapperservay>();
        
        questions = [select id,name,Status__c, Quest__c,option_types__c,(select PicklistValue__c from DynamicPicklists__r) from Questionn__c];

        
        for(Questionn__c w:questions){
            
            
             wrapperservay w1 = new wrapperservay();
                                                    w1.qs = w ;
                                                    w1.QuestionId = w.id;
                                                    wrp.add(w1);
            
            
            if (options.containskey(w.Name)){
                 for(DynamicPicklist__c op:w.DynamicPicklists__r){
                    options.get(w.Name).add(new selectoption(op.PicklistValue__c,op.PicklistValue__c));
                
            }
            }else
            {
                options.put(w.Name,new list<SelectOption>());
                for(DynamicPicklist__c op:w.DynamicPicklists__r){
                    options.get(w.Name).add(new selectoption(op.PicklistValue__c,op.PicklistValue__c));
                        
                }
            }
        }
       

            
            
        }
    
    

    public void Save()
    {
        insert pat;
        for(wrapperservay wl : wrp)
        {
            
            
            
            //wl.qs
            
            
            
            Answer__c ua = new Answer__c();
            
            ua.Name = wl.Name;
             ua.Questionn__c = wl.QuestionId;       
            
            useranswers.add(ua);
            insert ua;                                    system.debug('#####################'+wl.QuestionId+'%%%%%%%%%%%%%%%%%%%%%'+wl.qs);                                                
        }                
     }                
      public class wrapperservay
        {
            
            public Id QuestionId{get;set;}
            
                        public String Name{get;set;}
                        public String Qtype{get;set;}
                        Public Questionn__c qs{get;set;}
                        
                        public wrapperservay()
                        {
                        
                            qs = new Questionn__c();
                              
                        }                                                                                                                                                          
        }        
    }

VF Page-----------------------------
<apex:page Controller="questions" showHeader="false">
<apex:form style="border:20px single #800080;">
  
  <center><apex:sectionHeader title="HOSPITAL FEEDBACK FORM " /> </center> 
    
    <style>
    
body { background-image: url("https://c.ap2.content.force.com/servlet/servlet.FileDownload?file=01528000002yz1C") } 

  body .bPageTitle .ptBody h1.noSecondHeader{
    font-size: 60px;
        
  }
        
        
  .body .bPageBlock, body #bodyCell .bResource .secondaryPalette, body .secondaryPalette.bPageBlock, body .individualPalette .secondaryPalette.bPageBlock, body .bodyDiv .genericTable, body .genericPageBlockTable, body .bodyDiv .bSubBlock, body .bComponentBlock .bPageBlock, body .bMyDashboard .bPageBlock, body.rlHoverFrame .bPageBlock, body.subjectSelectionPopup div.choicesBox, body.lookupTab .secondaryPalette.bPageBlock, body.popupTab .secondaryPalette.bPageBlock, body.UserTagStatsPage .secondaryPalette.bPageBlock{
        background-color: transparent !important;
        }
</style>
    
    <apex:pageBlock title=" PAITIENT DETAILS" >
        <div style="display: block;min-height: 5in;padding: 15px;">
        
        
            
       <apex:pageBlockSection columns="1" >
<apex:inputField value="{!pat.Name_of_the_paitient__c}"/>
 <apex:inputField value="{!pat.Phone_Number__c}"/>
   <apex:inputField value="{!pat.Email_Address__c}"/> 
  
           
       <apex:pageBlockSectionItem > GENDER:
               
        <apex:selectRadio label="Gender" value="{!pat.Gender__c}" >
                    <apex:selectOption itemLabel="Male" itemValue="male"/>
                    <apex:selectOption itemLabel="Female" itemValue="female"/>           
                </apex:selectRadio> 
    
           </apex:pageBlockSectionItem>
           
           
           </apex:pageBlockSection>
           
       
        
        
        <apex:repeat value="{!wrp}" var="q">
  
<font color='#b22222'>  
<apex:outputLabel value="{!q.qs.Quest__c}" style="font-family:Times New Roman;font-size: 20px;" ></apex:outputLabel><br/>
</font>
<apex:selectList value="{!q.Name}" multiselect="false" size="1"  style="font-size: 20px;"  >
    <apex:actionSupport event="onchange" rendered="{!(q.qs.option_types__c=='picklist',TRUE,FALSE)}" />
<apex:selectOptions value="{!options[q.qs.Name]}"/>
</apex:selectList><p/>
            
        
          <apex:selectCheckboxes value="{!q.Name}">
              <apex:actionSupport event="onchange" rendered="{!IF(q.qs.option_types__c=='checkboxes',TRUE,FALSE)}" />
          <apex:selectOptions value="{!options[q.qs.Name]}"></apex:selectOptions>
              
        </apex:selectCheckboxes><br/>        
           
</apex:repeat>
            
    
<apex:pageBlockButtons location="bottom"  >
    <apex:outputPanel style="float:Centre">
<apex:commandButton action="{!save}" value="Submit" style="font-size: 18px;color:red"  />
        </apex:outputPanel>
</apex:pageBlockButtons>
      
</div>
     

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

Thanks In Advance.
My Code For VF page:
 
<apex:page controller="SurveyType" tabStyle="Dynamic_Checkbox__c">
<apex:form >
<script>
function cbChange(obj) {
    var cbs = document.getElementsByClassName("cb");
    for (var i = 0; i < cbs.length; i++) {
        cbs[i].checked = false;
    }
    obj.checked = true;
}
</script>
<apex:pageBlock >
<apex:pageblockSection >

<apex:selectOption>
<apex:inputField value="{!dc.Good__c}" onchange="cbChange(this)" styleClass="cb" rendered="true" />Good<br/>
<apex:inputField value="{!dc.Bad__c}" onchange="cbChange(this)" styleClass="cb" rendered="true" />Bad<br/>
</apex:selectOption>
</apex:pageblockSection>
<apex:pageBlockButtons >
<apex:commandButton action="{!save}" value="save"/>

</apex:pageBlockButtons>

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

My Apex class:
public class SurveyType {
public Dynamic_Checkbox__c  dc{get;set;}

    public SurveyType (){
    dc = new Dynamic_Checkbox__c();     
    }

    public void save(){
     dc = new Dynamic_Checkbox__c();
    insert dc;
    }       
    }

Thanks in Advance
for(Contracting_Status__c cs : trigger.New)
    {
        if(trigger.isInsert)
        contractingid.add(cs.id);
        if(cs.Account__c != null && (cs.Contracting_Status__c != null))
        contrct_Accntid.add(cs.Account__c);
        if(cs.Carrier__c != null && (cs.Contracting_Status__c != null))
        Carrier_id.add(cs.Carrier__c);
        if(cs.Agency__c != null && (cs.Contracting_Status__c != null))
        Contrct_Agencyid.add(cs.Agency__c);
        if(trigger.isUpdate && cs.Agreement_release_date__c <= system.today())
        Contract_Id.add(cs.id);
        system.debug(cs.Carrier__c+'****PRINT CARRIER NAME****');
        if(cs.Product_Type__c != null && cs.Carrier__c == '00180000010mfZlAAI')
        ProductCode = cs.Product_Type__c;    
    }

Thank you.
trigger Status_Update on Contracting_Status__c (after insert,after update) 
{
    if(checkRecursive.runOnce())
    { 
 
    set<id> contrct_Accntid = new set<id>();
    set<id> Contrct_Agencyid = new set<id>();
    set<id> Carrier_id = new set<id>();
    set<id> Contract_Id = new set<id>();
    Set<Date> Date_Contracting = new Set<Date>();
    Set<id> contractingid = new Set<id>(); 
    String ProductCode = null;    
}
}
My Code For VF page:
 
<apex:page controller="SurveyType" tabStyle="Dynamic_Checkbox__c">
<apex:form >
<script>
function cbChange(obj) {
    var cbs = document.getElementsByClassName("cb");
    for (var i = 0; i < cbs.length; i++) {
        cbs[i].checked = false;
    }
    obj.checked = true;
}
</script>
<apex:pageBlock >
<apex:pageblockSection >

<apex:selectOption>
<apex:inputField value="{!dc.Good__c}" onchange="cbChange(this)" styleClass="cb" rendered="true" />Good<br/>
<apex:inputField value="{!dc.Bad__c}" onchange="cbChange(this)" styleClass="cb" rendered="true" />Bad<br/>
</apex:selectOption>
</apex:pageblockSection>
<apex:pageBlockButtons >
<apex:commandButton action="{!save}" value="save"/>

</apex:pageBlockButtons>

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

My Apex class:
public class SurveyType {
public Dynamic_Checkbox__c  dc{get;set;}

    public SurveyType (){
    dc = new Dynamic_Checkbox__c();     
    }

    public void save(){
     dc = new Dynamic_Checkbox__c();
    insert dc;
    }       
    }

Thanks in Advance
for(Contracting_Status__c cs : trigger.New)
    {
        if(trigger.isInsert)
        contractingid.add(cs.id);
        if(cs.Account__c != null && (cs.Contracting_Status__c != null))
        contrct_Accntid.add(cs.Account__c);
        if(cs.Carrier__c != null && (cs.Contracting_Status__c != null))
        Carrier_id.add(cs.Carrier__c);
        if(cs.Agency__c != null && (cs.Contracting_Status__c != null))
        Contrct_Agencyid.add(cs.Agency__c);
        if(trigger.isUpdate && cs.Agreement_release_date__c <= system.today())
        Contract_Id.add(cs.id);
        system.debug(cs.Carrier__c+'****PRINT CARRIER NAME****');
        if(cs.Product_Type__c != null && cs.Carrier__c == '00180000010mfZlAAI')
        ProductCode = cs.Product_Type__c;    
    }

Thank you.
trigger Status_Update on Contracting_Status__c (after insert,after update) 
{
    if(checkRecursive.runOnce())
    { 
 
    set<id> contrct_Accntid = new set<id>();
    set<id> Contrct_Agencyid = new set<id>();
    set<id> Carrier_id = new set<id>();
    set<id> Contract_Id = new set<id>();
    Set<Date> Date_Contracting = new Set<Date>();
    Set<id> contractingid = new Set<id>(); 
    String ProductCode = null;    
}
}