• Pavan Kumar P
  • NEWBIE
  • 25 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 7
    Replies
Hi,

Can anyone help me in test class code coverage for below mentioned part of code:

  List<T__c> tempT = [SELECT Id, Name, no__c, P__c FROM T__c WHERE no__c =: acc.no__c];
                ltc = new List<T__c>();

                for(T__c t : tempT)
                {
                    Boolean cF = false;
                    for(integer i = 0; i < ltc.size(); i++)
                    {
                        if(t.P__c.equalsIgnoreCase(ltc[i].P__c))
                        {
                            cF = true;
                            break;
                        }
                    }
                    if(!cF)
                    {
                        ltc.add(t);
                    }
                }
            }
            
            Set<String> stc = new Set<String>();

            for(T__c t : ltc)
            {
                if(!stc.contains(t.P__c))
                {
                    stc.add(t.P__c);
                }  
            }

            if(!stc.isEmpty())
            {
                MNO.add(new sOpt('','- None -'));
                for(String tc : stc)
                {
                    system.debug('TC P: '+tc);
                    MNO.add(new sOpt(tc,tc));
                }    
            }        


Thanks in advance.

Regards,
Pavan.
Hi,

I have a scenario where custom link should redirect to report with filter value passed in both lightning and classic depending which user it is.

See the custom link which I have tried which is redirecting correctly to Report for classic users but not for lightning users:

/{!IF($User.UIThemeDisplayed="Theme4d","lightning/r/Report/","")}<ReportID>?{!IF($User.UIThemeDisplayed="Theme4d","fv2","pv2")}={!<sObject>.<fieldname>}

Could you please help me in modifying the above custom link in such a way that it works in both classic and lightning users

Thanks in Advance.

Regards,
Pavan Kumar P.
Hi,

Could you please help me in writing test class for below mentioned controller:

Visualforce Page:
<apex:page controller="ServiceTest">
 <style type="text/css">
  #title {
  font-size: 150%;
  margin-left: 30%;
  }
 </style>
  
  <h2 id="title">Update Emp Records</h2><br/><br/>
    <apex:form >
     <apex:pageBlock >
       <apex:pageBlockSection >
       <apex:inputField value="{!emps.Name}"/>
        <apex:outputField value="{!emps.Name}"/>
       <apex:inputField value="{!emps.Start_Date__c}"/>
        <apex:outputField value="{!emps.Start_Date__c}"/>
       <apex:inputField value="{!emps.End_Date__c}"/>
        <apex:outputField value="{!emps.End_Date__c}"/>
      
       </apex:pageBlockSection>
       <apex:pageBlockButtons >
       <apex:commandButton value="Update" action="{!UpdateRecord}"/>
       </apex:pageBlockButtons>
    
         <apex:pageMessage rendered="{!status}" severity="error" />
         <apex:pageMessages />
    
    </apex:pageBlock>
    </apex:form> 
         
</apex:page>




Controller:

public class ServiceTest {
 
  public Employee__c emps {get;set;}
    public boolean status {get;set;}
 
    
    public ServiceTest ()
    {
           status= false;
      emps = [select Name, Start_Date__c, End_Date__c from Employee__c LIMIT 1];   
    }

    
 
    public PageReference updateRecord(){      
        if(emps.Start_Date__c > emps.End_Date__c){          
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'Start Date should not be less than End Date'));
            status= true;
        }
        else{
            update emps;
            }
            return null;
            
    
    }    
}


Thanks in Advance.

Regards,

Pavan.
trigger opptoacc on Opportunity (after insert,after update) {

    list<Account> acctList = new list<Account>();
    Set<Id> accId = new Set<Id>();
    
    for(Opportunity opp: Trigger.New){
        accId.add(opp.accountId);
        
    }
    
    
    for(Account acc:[SELECT Id,Name,Industry FROM Account WHERE Id IN: accId]){
        for(Opportunity op1:Trigger.New){

       if(Trigger.isInsert && op1.Name=='something'){

                acc.Rating='hot';

                acctList.add(acc);


            }
            
            
           
        }
    
    }
    
}

I need test class that covers more than 75% of code.

Thanks in Advance.

Regards,
Pavan Kumar P.
 
Hi,

I have a scenario where custom link should redirect to report with filter value passed in both lightning and classic depending which user it is.

See the custom link which I have tried which is redirecting correctly to Report for classic users but not for lightning users:

/{!IF($User.UIThemeDisplayed="Theme4d","lightning/r/Report/","")}<ReportID>?{!IF($User.UIThemeDisplayed="Theme4d","fv2","pv2")}={!<sObject>.<fieldname>}

Could you please help me in modifying the above custom link in such a way that it works in both classic and lightning users

Thanks in Advance.

Regards,
Pavan Kumar P.
Hi,

Could you please help me in writing test class for below mentioned controller:

Visualforce Page:
<apex:page controller="ServiceTest">
 <style type="text/css">
  #title {
  font-size: 150%;
  margin-left: 30%;
  }
 </style>
  
  <h2 id="title">Update Emp Records</h2><br/><br/>
    <apex:form >
     <apex:pageBlock >
       <apex:pageBlockSection >
       <apex:inputField value="{!emps.Name}"/>
        <apex:outputField value="{!emps.Name}"/>
       <apex:inputField value="{!emps.Start_Date__c}"/>
        <apex:outputField value="{!emps.Start_Date__c}"/>
       <apex:inputField value="{!emps.End_Date__c}"/>
        <apex:outputField value="{!emps.End_Date__c}"/>
      
       </apex:pageBlockSection>
       <apex:pageBlockButtons >
       <apex:commandButton value="Update" action="{!UpdateRecord}"/>
       </apex:pageBlockButtons>
    
         <apex:pageMessage rendered="{!status}" severity="error" />
         <apex:pageMessages />
    
    </apex:pageBlock>
    </apex:form> 
         
</apex:page>




Controller:

public class ServiceTest {
 
  public Employee__c emps {get;set;}
    public boolean status {get;set;}
 
    
    public ServiceTest ()
    {
           status= false;
      emps = [select Name, Start_Date__c, End_Date__c from Employee__c LIMIT 1];   
    }

    
 
    public PageReference updateRecord(){      
        if(emps.Start_Date__c > emps.End_Date__c){          
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'Start Date should not be less than End Date'));
            status= true;
        }
        else{
            update emps;
            }
            return null;
            
    
    }    
}


Thanks in Advance.

Regards,

Pavan.
trigger opptoacc on Opportunity (after insert,after update) {

    list<Account> acctList = new list<Account>();
    Set<Id> accId = new Set<Id>();
    
    for(Opportunity opp: Trigger.New){
        accId.add(opp.accountId);
        
    }
    
    
    for(Account acc:[SELECT Id,Name,Industry FROM Account WHERE Id IN: accId]){
        for(Opportunity op1:Trigger.New){

       if(Trigger.isInsert && op1.Name=='something'){

                acc.Rating='hot';

                acctList.add(acc);


            }
            
            
           
        }
    
    }
    
}

I need test class that covers more than 75% of code.

Thanks in Advance.

Regards,
Pavan Kumar P.
 
Hello,

I am getting below error while trying to use force:createRecord in one of my lightning component
User-added image

Here is little code excerpt where xQualification_Comment__c is custom object.
Below is js for component:
User-added image
Here is component 
User-added image
I'm doing the simple lightning components challenge and have hit this problem in my existing trailhead org and a brand new dev org that I've just created:

Challenge not yet complete... here's what's wrong: 
There was an unexpected error while verifying this challenge. Usually this is due to some pre-existing configuration or code in the challenge Org. We recommend using a new Developer Edition (DE) to check this challenge. If you're using a new DE and seeing this error, please post to the developer forums and reference error id: QVWBQHAG