• Aneesh Allumalla
  • NEWBIE
  • 90 Points
  • Member since 2018

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 15
    Replies
I try check if opportunity exists.
I know for sure that yes and it goes into a loop, but then it throws an error 'System.NullPointerException'. Why?
@AuraEnabled(cacheable=true)
    public static List<Account> getRecById(String recId) {
        List<Account> listofaccts = [SELECT Total_Opportunity_Amount__c, Name, (SELECT Id, Name, Amount, CreatedDate, CloseDate FROM Opportunities WHERE StageName = 'Closed Won' ) FROM Account WHERE id=:recId ];
         List<Account> resultAcc;
        for(Account acc : listofaccts){
              if(!acc.Opportunities.isEmpty())
              {
                  resultAcc.add(acc);
              }
           }
         return resultAcc;
    }
Thanks in advance.
 
Hi all,
One picklist is there, it consists values of Pulsar, FZ, Glamour above three values had a three bike images.At in picklist we select pulsar then pulsar image can be show remaining images can be hide, if FZ is select from picklist then FZ iamge can be show and remaining images can be hide, if Glamour is selected from picklist then Glamour image can be show remaining images can be hide

The above is the code that i tried
VF Code
<apex:page controller="Picklist_Show_Hide_Img_Con">
<apex:form >
<apex:selectList id="Picklist_Show_Hide_Img_Con" value="{!w}" size="1">
<apex:actionSupport action="{!showhideimg}" event="onchange"/>
            <apex:selectOption itemValue="Pulsar" itemLabel="Pulsar"/>
            <apex:selectOption itemValue="FZ" itemLabel="FZ"/>
            <apex:selectOption itemValue="Glamour" itemLabel="Glamour"/>
</apex:selectList> <br />
<apex:image value="{!$Resource.Pulsar}" rendered="{!x}" width="200" height="200"/>
<apex:image value="{!$Resource.FZ}" rendered="{!y}" width="200" height="200"/>
<apex:image value="{!$Resource.Glamour}" rendered="{!z}" width="200" height="200"/>
</apex:form>
</apex:page>
Apex Code
public class Picklist_Show_Hide_Img_Con {

    public Boolean z { get; set; }

    public Boolean y { get; set; }

    public Boolean x { get; set; }
    
    public Picklist_Show_Hide_Img_Con() {
        x = true;
        y = true;
        z = true;
    }
    
    public PageReference showhideimg() {
        if(w==x){
            x = true;
            y = false;
            z = false;
        }
        
        if(w==y){
            x = false;
            y = true;
            z = false;
        }
        
        if(w==z){
            x = false;
            y = false;
            z = true;
        }
        return null;
    }


    public String w { get; set; }
}
Please rectify my problem. Thank you very much !

 
Hi!
I have a requirement where I need to get account name and under it ,should have the related Contacts with thier names in rows. It should be in a visual force page.
Ex:
Aneesh
  A1
  A2

Charan 
  C1
  C2
.
.
.
.
.
Like this
Hi,
I want my records to be clickable in the pagebocktable that redirect to detailed page.
My class:
public class Dev6 {
    Public List<Account> accList{set;get;}
    Public String city{get;set;}
    Public boolean show{get;set;}
    Public Dev6(){
        show=false;
    }
    public void showList(){
        show=true;
        acclist=[select Name,ID from Account where BillingCity=:city];        
    }     
}
Vf Page:
<apex:page controller="Dev6">
    <apex:form >
    <apex:pageblock>
        <apex:pageBlockSection columns="1" >
        <apex:inputtext label="Billing City" value="{!city}" />
            <apex:commandButton title="A" value="Show" action ="{!showList}"/>
                   </apex:pageBlockSection>
        <apex:outputPanel id="a">
        <apex:pageBlockSection >
        <apex:pageBlockTable value="{!acclist}" var="s" rendered="{!show}">
            <apex:outputLink value="/{!s.ID}"  >
            </apex:outputLink>
            <apex:column value="{!s.Name}" title="NAME" />
            </apex:pageBlockTable>
        </apex:pageBlockSection>
            </apex:outputPanel>
        </apex:pageblock>
    </apex:form>
</apex:page>

Please suggest a way without using java script
Hi,
My requirement is I have to create a simple vf page with one input field and one button. on clicking the button the value entered in the input field of the first page should be displayed in a pdf page.
Here is my code:
Controller:
public class PDFpage {
    Public String x{get;set;}
    Public String y{get;set;}
    Public PDFpage(){}
    Public pagereference submit(){
        y=x;
        PageReference pr = new PageReference('https://c.ap4.visual.force.com/apex/PDFpage2') ;  
        pr.setRedirect(true);
        return pr;
    }    
}

VFpage1:
<apex:page controller="PDFpage" >
    <apex:form >
        <apex:pageblock >
                <apex:pageBlockSection>
                    <apex:inputText label="Name" value="{!x}"/>
                </apex:pageBlockSection>
            <apex:pageBlockSection >
                <apex:commandButton action="{!submit}" value="submit"/>
            </apex:pageBlockSection>
        </apex:pageblock>
    </apex:form>
</apex:page>

Vfpage2:

<apex:page controller="PDFpage" >
    <apex:form >
        <apex:pageblock >
                <apex:pageBlockSection>
                    <apex:outputText value="{!y}"/>
                </apex:pageBlockSection>
        </apex:pageblock>
    </apex:form>
</apex:page>
When I click the button after entering the value, it is creating an empty PDF without any value displaying  in it.
Can anyone help how to get the value on to the PDF page.
 
I am trying to show the list of account records on vf page:
there is no error. But it is not retrieving any list on vf page.
can someone tell me the reason.
Class:
public class Dev12 {
    public String city{get;set;} 
    public list<account> acclist{get;set;}
    public boolean showTable{get;set;}
    Public Dev12(){
        showTable=false;
}
    Public void showT(){
        List <account> acclist = new List<account>();
        acclist = [Select name , phone, BillingCity from account  where name =:city];
    showTable=true;
    }
}

Vf page:
<apex:page controller="Dev12">
    <apex:form >
    <apex:pageBlock >
        <apex:pageblocksection >
            <apex:inputtext value="{!city}" label="City"/>
            
        </apex:pageblocksection>
        <apex:pageBlockButtons >
            <apex:commandButton value="show" action="{!showT}" reRender="table" />
                   </apex:pageBlockButtons>
        <apex:outputPanel id="table">
        <apex:pageBlockTable rendered="{!showTable==true}" value="{!acclist}" var="a">
            <apex:column value="{!a.name}"/>
            <apex:column value="{!a.phone}"/>
           
            </apex:pageBlockTable>
        </apex:outputPanel>
        </apex:pageBlock>
    </apex:form>
</apex:page>
I try check if opportunity exists.
I know for sure that yes and it goes into a loop, but then it throws an error 'System.NullPointerException'. Why?
@AuraEnabled(cacheable=true)
    public static List<Account> getRecById(String recId) {
        List<Account> listofaccts = [SELECT Total_Opportunity_Amount__c, Name, (SELECT Id, Name, Amount, CreatedDate, CloseDate FROM Opportunities WHERE StageName = 'Closed Won' ) FROM Account WHERE id=:recId ];
         List<Account> resultAcc;
        for(Account acc : listofaccts){
              if(!acc.Opportunities.isEmpty())
              {
                  resultAcc.add(acc);
              }
           }
         return resultAcc;
    }
Thanks in advance.
 
global class MonthlyMatterInactive 
{
    global static String monthlyMatterInactive() 
    {
        Map<Id,Monthly_Matter_Execution__c> mmeMap = new Map<Id,Monthly_Matter_Execution__c>( [SELECT Id, Date_Executed__c from Monthly_Matter_Execution__c where Date_Executed__c = LAST_MONTH] );
        if(mmeMap.size() != 0)
        {
            list<matter__c> matter= [Select Id, OwnerId, Client__c, Prospect__c, Billing_RateLU__c from Matter__c where Consultation_Matter__c = TRUE and Set_Inactive__c = FALSE Order By CreatedDate DESC Limit 2];
            
            matter__c previousMatter =matter[1];
            
            if(previousMatter != null)
            {
                Matter__c previousMatterUpdate = new Matter__c();
                previousMatterUpdate.Id = previousMatter.Id;
                previousMatterUpdate.Set_Inactive__c = TRUE;
                Update previousMatterUpdate;
            }
        }
        return null;
    }
}



test class with 36% code coverage :

@istest
public class MonthlyMatterInactiveTest
{
    @istest  
    public static void testMethod2() {
        // code_block    
        // 
        test.startTest();
        Account acct = new Account(
            FirstName='test rohini',
            LastName='test twopir'
        ); 
        insert acct;
        
        Propsect__c prop =new Propsect__c(
            Spouses_First_Name__c='test',
            Spouses_Name__c='test',Person__c=acct.id);
        insert prop;
        

        list<matter__c> matter= new list<matter__c>();
        // matter.add(mat);
        
        Matter__c mattercObj = new Matter__c (
            Client__c = acct.id,  
            Prospect__c = prop.id,
            Status__c = 'Active',
            Type__c = 'Consultation',
            Apply_Fixed_Fee__c = FALSE,
            Fixed_fee_Amount__c = NULL,
            Send_Invoices_By__c = 'Mail',
            Apply_Interest__c = FALSE,
            Set_Inactive__c=False,
            Refresher_Amount__c=2345,
            Refresher_Required__c=true,
            Name='Consultations - Non Retainer ',   
            Consultation_Matter__c=True
        );
        matter.add(mattercObj);
        insert(matter);
        
        MonthlyMatterInactive.monthlyMatterInactive();
        test.stopTest();
    }       
    
}
Hi all,
One picklist is there, it consists values of Pulsar, FZ, Glamour above three values had a three bike images.At in picklist we select pulsar then pulsar image can be show remaining images can be hide, if FZ is select from picklist then FZ iamge can be show and remaining images can be hide, if Glamour is selected from picklist then Glamour image can be show remaining images can be hide

The above is the code that i tried
VF Code
<apex:page controller="Picklist_Show_Hide_Img_Con">
<apex:form >
<apex:selectList id="Picklist_Show_Hide_Img_Con" value="{!w}" size="1">
<apex:actionSupport action="{!showhideimg}" event="onchange"/>
            <apex:selectOption itemValue="Pulsar" itemLabel="Pulsar"/>
            <apex:selectOption itemValue="FZ" itemLabel="FZ"/>
            <apex:selectOption itemValue="Glamour" itemLabel="Glamour"/>
</apex:selectList> <br />
<apex:image value="{!$Resource.Pulsar}" rendered="{!x}" width="200" height="200"/>
<apex:image value="{!$Resource.FZ}" rendered="{!y}" width="200" height="200"/>
<apex:image value="{!$Resource.Glamour}" rendered="{!z}" width="200" height="200"/>
</apex:form>
</apex:page>
Apex Code
public class Picklist_Show_Hide_Img_Con {

    public Boolean z { get; set; }

    public Boolean y { get; set; }

    public Boolean x { get; set; }
    
    public Picklist_Show_Hide_Img_Con() {
        x = true;
        y = true;
        z = true;
    }
    
    public PageReference showhideimg() {
        if(w==x){
            x = true;
            y = false;
            z = false;
        }
        
        if(w==y){
            x = false;
            y = true;
            z = false;
        }
        
        if(w==z){
            x = false;
            y = false;
            z = true;
        }
        return null;
    }


    public String w { get; set; }
}
Please rectify my problem. Thank you very much !

 
Hi!
I have a requirement where I need to get account name and under it ,should have the related Contacts with thier names in rows. It should be in a visual force page.
Ex:
Aneesh
  A1
  A2

Charan 
  C1
  C2
.
.
.
.
.
Like this
I am trying to show the list of account records on vf page:
there is no error. But it is not retrieving any list on vf page.
can someone tell me the reason.
Class:
public class Dev12 {
    public String city{get;set;} 
    public list<account> acclist{get;set;}
    public boolean showTable{get;set;}
    Public Dev12(){
        showTable=false;
}
    Public void showT(){
        List <account> acclist = new List<account>();
        acclist = [Select name , phone, BillingCity from account  where name =:city];
    showTable=true;
    }
}

Vf page:
<apex:page controller="Dev12">
    <apex:form >
    <apex:pageBlock >
        <apex:pageblocksection >
            <apex:inputtext value="{!city}" label="City"/>
            
        </apex:pageblocksection>
        <apex:pageBlockButtons >
            <apex:commandButton value="show" action="{!showT}" reRender="table" />
                   </apex:pageBlockButtons>
        <apex:outputPanel id="table">
        <apex:pageBlockTable rendered="{!showTable==true}" value="{!acclist}" var="a">
            <apex:column value="{!a.name}"/>
            <apex:column value="{!a.phone}"/>
           
            </apex:pageBlockTable>
        </apex:outputPanel>
        </apex:pageBlock>
    </apex:form>
</apex:page>