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

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 7
    Replies
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