• Jagadeesh111
  • NEWBIE
  • 10 Points
  • Member since 2015
  • trekbin

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 8
    Likes Given
  • 0
    Questions
  • 10
    Replies
Hi All,
These are my Controller and my Test Class.
Whatever I change I could not reach more than 50% coverage.
Could you please help me to get at least 75% to deploy in Production?
public class MyCPDPointsAPEXController {
    
@AuraEnabled    
    public CPD_Points_Total__c total {get;set;}
    string recordId = ApexPages.currentPage().getParameters().get('recordId');
    
    public MyCPDPointsAPEXController(ApexPages.StandardController controller) { 
        
        total = [select Id, Name, Total_Points__c, (select Id, Activity_Date__c, Activity_Title__c, Organiser_Company__c, Points__c from CPD_Register__r) from CPD_Points_Total__c where Id=:ApexPages.currentPage().getParameters().get('recordId')];
    }
    
    public PageReference cancel(){   
        return new PageReference('/' + recordId);   
    }
}
 
@isTest
private class MyCPDPointsAPEXTest {
    
    static testMethod void MyTest()
    {
        CPD_Points_Total__c total = new CPD_Points_Total__c(Name='Test-2017');  
        
        ApexPages.CurrentPage().getparameters().put('id', total.id);      
        
        Apexpages.StandardController sc = new Apexpages.StandardController(total);
        MyCPDPointsAPEXController ext = new MyCPDPointsAPEXController(sc); 
        
        ext.cancel();      
    }
}



Thank you in advance for your help.
Sylvie
 
<apex:page standardcontroller="Opportunity" extensions="myOpptyController" tabStyle="Opportunity">

          <apex:pageBlock title="opportunity product related list">

             <apex:pageBlockTable value="{!opptyList}" var="div">

               <apex:column >

                        <apex:pageBlockTable value="{!div.OpportunityLineItems}" var="custom">

                        <apex:column value="{!custom.Quantity}"/>

                        <apex:column value="{!custom.UnitPrice}"/>

                        <apex:column value="{!custom.TotalPrice}"/>

                        <apex:column value="{!custom.PricebookEntry.Name}"/>

                        <apex:column value="{!custom.PricebookEntry.Product2.Family}"/>

                    </apex:pageBlockTable>

            </apex:column>   

     </apex:pageBlockTable>

    </apex:pageBlock>

    </apex:page>

Class is as follows:
public class myOpptyController {

    public myOpptyController(ApexPages.StandardController controller) {

    }     

        public List<Opportunity> opptyList{get;set;}

       // public List<OpportunityListItems> opptyList1{get;set;}

        public myOpptyController() {
     

        opptyList = [SELECT Id,Name,

             (SELECT ID, Quantity, UnitPrice, TotalPrice,PricebookEntry.Name, PricebookEntry.Product2.Family FROM OpportunityLineItems)

                            FROM Opportunity WHERE Id =: ApexPages.currentPage().getParameters().get('ID')];

                  //   System.debug('opptyList ='+opptyList);

        }

         

      //  public List<Opportunity> getopptyList() {

      //      return opptyList;
    //    }
      

    }
This code is not displaying opportunitylineitem table
I need to be able to see the logs created by my code using system.debug inclusive if I am offline.
How can this be done?
How to write @Test Class for Following Controller :

public with sharing class ReportController { 
                   
    Public Id lookupid{get;set;}
    public Question_Bank_Page__c obj1{get;set;}
    public Question_Option__c lookup;
    public List<Question_Option__c> OptionList{get;set;}
    public List<Question_Option__c> OptionList2{get;set;}
    public Question_Option__c Option{get;set;}
    private ApexPages.StandardController controller;
   
    public PageReference lookupid() {
        
        System.debug('****************Lookup id new*1************************'+obj1.Feedback__c);
        return null;
    }
    public ReportController(ApexPages.StandardController controller) {
        obj1= (Question_Bank_Page__c)controller.getRecord();
         System.debug('****************Lookup id new*2************************'+obj1.Feedback__c); 
    }
    public PageReference PassingParameter(){
        lookupid=obj1.Feedback__c;
        system.debug('++++++++++++++++LOOKUP ID++++++++++++++++++++'+lookupid);
        
        OptionList=[Select Customer_Name__c, CreatedDate, Customer_Email__c, Customer_Phone__c, Response__c, Question__r.Related_Feedback__r.Feedback_Name__c, 
        Question__r.Related_Feedback__r.Count_Question__c, Question__r.Related_Feedback__r.Feedback_Taken_by_Contact__c, Question__r.Question__c, 
        Question__r.Related_Feedback__r.CreatedDate From Question_Option__c where Question__r.Related_Feedback__c=:lookupid Limit 1];
        system.debug('++++++++++++++++++++OPTION LIST++++++++++++++++++++'+OptionList);
        
        OptionList2=[Select Customer_Name__c, CreatedDate, Response__c, Question__r.Question__c From Question_Option__c where Question__r.Related_Feedback__c=:lookupid];
        system.debug('++++++++++++++++++++OPTION LIST++++++++++++++++++++'+OptionList2);
        return null;
    }
Hi Guys, can anyone help me on cross object formula field? If any material available please post.
Hi,

i have one SOQL query like 
SELECT id FROM businesshours WHERE Name = 'UK'
Is it possible to get using dynamic apex...........................

Adv Thnx
VSK
  • April 25, 2016
  • Like
  • 1
Hi All,

I have created two visualforce pages. One with command button. When i click on button it will redirect to the second vf page. In first vf page controller am fetching the contact fields. Now i want to use those contact fields in second vf page controller. How to do this.. below is my vf pages and its controllers.

VF Page : 1
<apex:page standardController="Contact" extensions="TestController">
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockSection >
            <apex:commandButton value="Login" action="{!Login}"/>
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>

Controller : 1
public with sharing class TestController {
    Private Contact con;
    public YodleeController(ApexPages.StandardController controller) {
        String ConId = ApexPages.CurrentPage().getparameters().get('id');
        Contact con = [Select id, FirstName, LastName, PAN_ID__c from Contact where id=:ConId];
        system.debug('conId--'+con.id);
        system.debug('conPAN---'+con.PAN_ID__c);
    }
    public PageReference Login() {
        PageReference page = new PageReference('/apex/LinkAccess');
        page.setRedirect(true);
        return page;
    }  
}

VF Page : 2

<apex:page controller="LinkAccessController">
    <HTML>
        <HEAD>
        </HEAD>
        <BODY>
            <form action="https://test.com/"  method="POST" id="sessionPost"><br/><br/>  
               
                app Id
                <input type="text" name="app"  /><br/><br/> 
                
                session
                <input type="text" name="rsession"  /> <br/><br/>
                
                tokenID
                <input type="text" name="token"  /> <br/><br/>
                
                Redirect Required 
                <input type="text" name="redirectReq" placeholder="true" value="True"/><br/><br/>
                
                <script>document.getElementById('sessionPost').submit();</script>
                </form>
            </BODY>
        </HTML>
</apex:page>


Controller : 2
public with sharing class LinkAccessController {
// Some code is there..
// Here i want use the contact fields from first controller to do some operation
}


 
Hi guys,

Can you please help me out and tell whether we can assign different page layouts to different standard or custom objects?
<apex:page standardcontroller="Opportunity" extensions="myOpptyController" tabStyle="Opportunity">

          <apex:pageBlock title="opportunity product related list">

             <apex:pageBlockTable value="{!opptyList}" var="div">

               <apex:column >

                        <apex:pageBlockTable value="{!div.OpportunityLineItems}" var="custom">

                        <apex:column value="{!custom.Quantity}"/>

                        <apex:column value="{!custom.UnitPrice}"/>

                        <apex:column value="{!custom.TotalPrice}"/>

                        <apex:column value="{!custom.PricebookEntry.Name}"/>

                        <apex:column value="{!custom.PricebookEntry.Product2.Family}"/>

                    </apex:pageBlockTable>

            </apex:column>   

     </apex:pageBlockTable>

    </apex:pageBlock>

    </apex:page>

Class is as follows:
public class myOpptyController {

    public myOpptyController(ApexPages.StandardController controller) {

    }     

        public List<Opportunity> opptyList{get;set;}

       // public List<OpportunityListItems> opptyList1{get;set;}

        public myOpptyController() {
     

        opptyList = [SELECT Id,Name,

             (SELECT ID, Quantity, UnitPrice, TotalPrice,PricebookEntry.Name, PricebookEntry.Product2.Family FROM OpportunityLineItems)

                            FROM Opportunity WHERE Id =: ApexPages.currentPage().getParameters().get('ID')];

                  //   System.debug('opptyList ='+opptyList);

        }

         

      //  public List<Opportunity> getopptyList() {

      //      return opptyList;
    //    }
      

    }
This code is not displaying opportunitylineitem table
trigger defaultaction on Account(before insert,before update){
for(account acc : trigger.new){
acc.Phone='24243';

}

}
I need to be able to see the logs created by my code using system.debug inclusive if I am offline.
How can this be done?
Hello,

---------TRIGGER----------

trigger UpdateReportName on ActivityPlanningAndReport__c (before insert) {
     Map<Id,User> ownerMap;
     Set<Id> oppOwnerIds = new Set<Id>();
     String nameOfOwner;
     for(ActivityPlanningAndReport__c p : trigger.new)
    {
        oppOwnerIds.add(p.OwnerId);
    }
     ownerMap = new Map<Id,User>([SELECT Id, Name FROM User WHERE Id IN :oppOwnerIds]);
     for(ActivityPlanningAndReport__c p : trigger.new)
     {
          nameOfOwner = ownerMap.get(p.OwnerId).Name;
        if(p.Name!=null)
        {
            p.Name = p.Country_txt__c+'_'+ p.Display_Engagement_Date__c+'_'+nameOfOwner;
     }
     }   
   }
Hi all,

When I press the lookup button on a field, It shows only the recently viewed items.

Is it possible to show all the lookup items.

Thanks in advance
Hi,

i have one SOQL query like 
SELECT id FROM businesshours WHERE Name = 'UK'
Is it possible to get using dynamic apex...........................

Adv Thnx
VSK
  • April 25, 2016
  • Like
  • 1
Hi,
 I'm confusing where to post my Questions whether in Success Community or developer forums.

And we can post Ideas and Connect to user groups etc..  from Success Community. Where as posting questions how they differ.

What is the main difference and which is having best visibility  to get solutions.