• Emma Tolley
  • NEWBIE
  • 5 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 2
    Replies
I have a custom object which i am displaying in a visualforce page via a simple list view method. I am displaying 'the' mini layout on a mouse hover which works fine using the code below.
 
<apex:column headervalue="PD Record Name" rendered="{!FilterID ='00B24000004AA6tEAG'}">              
                    <c id="{!me.Id}"  onmouseover="LookupHoverDetail.getHover('{!me.Id}', '/{!me.Id}/m?retURL={!me.Id}&isAjaxRequest=1').show();" onmouseout="LookupHoverDetail.getHover('{!me.Id}').hide();" onfocus="LookupHoverDetail.getHover('{!me.Id}', '/{!me.Id}/m?retURL={!me.Id}&isAjaxRequest=1').show();" onblur="LookupHoverDetail.getHover('{!me.Id}').hide();" href="/{!me.Id}">
                    {!me.Name} 
                    </c>  </apex:column>
I simply wish to change this to show a different mini layout. I have created two mini layouts and i want to display the 2nd one in this particular visualforce page (i still need the 1st one elsewhere). How do I specify which mini layout is used?

Thanks for the help.
Emma

 
Hi All,

Please help a struggling newbie (very struggling & very new!). I have an Apex Class & a VisualForce page which I believe should work. I am completely failing in writing a test class that gives me anything greater than 0% code coverage in my sandbox.

The basic premise is that I want to display a filtered list of records from my custom object in a visualforce page, the user will then be able to update certain fields, press Save and the records will update.

My apex class & visualforce page (/FTFEdit) code are below (these have been improved by a kind developer on these forums already).

Please, please can a nice kind person help me with a test class that works.

Thanks
Emma
 
public with sharing class Controller_FTFView{
    public List<PD_Record__c> FTFRecords {get; set;}

    public Controller_FTFView(){
        FTFRecords= [
            SELECT Name, Closure_Outcome__c, FTF__c, FTF_Comment__c, FTF_Reason__c, RFA_Number__c,WR_Number__c
            FROM PD_Record__c
            WHERE WMIS_Patch__c Like '11A5%' AND Owner_Is_Me__c = 0 AND Job_Status__c = 'Closed - Successful' AND (Closure_Outcome__c = 'Parts Ordered - In Stock' OR Closure_Outcome__c = 'Parts Ordered - OOS - Is obtainable' or Closure_Outcome__c = 'One Time Buy - Obtainable' or Closure_Outcome__c = 'Safety Reasons i.e. Manufacturer referral' or Closure_Outcome__c = 'Appliance Replacement Rec. (ART)')];
    }

    public PageReference save(){
        try{
            update FTFRRecords;
        }catch(DMLException e){
            //Report DML exceptions to the Apex Page messages element in Visualforce
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Error,e.getMessage()));
        }

        //Returning null for the page reference, directs user back to the same VF page, but rerenders values.
        //Otherwise, you could return another Visualforce page or a link to a record's detail page here as well.
        return null;
    }

    public PageReference cancel(){
        //Return a link to the parent record perhaps or do something else besides return null here
        return null;
    }
}
<apex:page Controller="Controller_FTFView" >
    <apex:sectionHeader title="" subtitle="Mass Edit"/>
    <apex:pageMessages id="messages" />
    <apex:form >
            <apex:pageBlock mode="detail" title="Edit the following records" id="pb">
            <apex:pageBlockButtons >
                <apex:commandButton action="{!save}" value="Save" rerender="pb,messages"/>
                <apex:commandButton action="{!cancel}" value="Cancel" rerender="pb,messages"/>
                 </apex:pageBlockButtons>          
            <apex:pageBlockSection columns="1">
                  <apex:pageBlockTable value="{!FTFRecords}" var="p">
                    <apex:column value="{!p.Name}"/>          
                    <apex:column value="{!p.WR_Number__c}"/>
                    <apex:column value="{!p.RFA_Number__c}"/>
                    <apex:column value="{!p.Closure_Outcome__c}"/>     
                    <apex:column headerValue="FTF?" >                   
                        <apex:inputField value="{!p.FTF__c}"/>
                    </apex:column>
                    <apex:column headerValue="FTF Reason" >                   
                        <apex:inputField value="{!p.FTF_Reason__c}"/>
                    </apex:column>
                    <apex:column headerValue="FTF Comment" >
                        <apex:inputField value="{!p.FTF_Comment__c}"/>
                    </apex:column>                    
                  </apex:pageBlockTable>
       </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>



 
I have a large number of records in Salesforce in a custom object. Each hour we loaded in more records for our users to work on. Sometimes they cannot work on some records so they close them down. This takes a long time to go into each one individually. So i want to give them a list of records based on a certain set of criteria and then they can update each one and click save. Seems simple but i have been tearing my hair out for days. Please help. I am VERY new to Salesforce. Please, please be very specific if you are able to give me guidance.

This is my controller (apex class)

public with sharing class Controller_FTFView{
    Transient public List<PD_Record__c> FTFRecords;
    public List<PD_Record__c> getFTFRecords() {
            FTFRecords= [
            SELECT Name, Closure_Outcome__c, FTF__c, FTF_Comment__c, FTF_Reason__c, RFA_Number__c,WR_Number__c
            FROM PD_Record__c
            WHERE WMIS_Patch__c Like '11A5%' AND Owner_Is_Me__c = 0 AND Job_Status__c = 'Closed - Successful' AND (Closure_Outcome__c = 'Parts Ordered - In Stock' OR Closure_Outcome__c = 'Parts Ordered - OOS - Is obtainable' or Closure_Outcome__c = 'One Time Buy - Obtainable' or Closure_Outcome__c = 'Safety Reasons i.e. Manufacturer referral' or Closure_Outcome__c = 'Appliance Replacement Rec. (ART)')];
        return FTFRecords;
    }
}

This is my visual force page

<apex:page Controller="Controller_FTFView" >
    <apex:sectionHeader title="" subtitle="Mass Edit"/>
    <apex:pageMessages />
    <apex:form >
            <apex:pageBlock mode="detail" title="Edit the following records" >
            <apex:pageBlockButtons >
                <apex:commandButton action="{!save}" value="Save"/>
                <apex:commandButton action="{!cancel}" value="Cancel"/>
                 </apex:pageBlockButtons>          
            <apex:pageBlockSection columns="1">
                  <apex:pageBlockTable value="{!FTFRecords}" var="p">
                    <apex:column value="{!p.Name}"/>          
                    <apex:column value="{!p.WR_Number__c}"/>
                    <apex:column value="{!p.RFA_Number__c}"/>
                    <apex:column value="{!p.Closure_Outcome__c}"/>     
                    <apex:column headerValue="FTF?" >                   
                        <apex:inputField value="{!p.FTF__c}"/>
                    </apex:column>
                    <apex:column headerValue="FTF Reason" >                   
                        <apex:inputField value="{!p.FTF_Reason__c}"/>
                    </apex:column>
                    <apex:column headerValue="FTF Comment" >
                        <apex:inputField value="{!p.FTF_Comment__c}"/>
                    </apex:column>                    
                  </apex:pageBlockTable>
       </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>

It does not like these buttons                

<apex:commandButton action="{!save}" value="Save"/>
<apex:commandButton action="{!cancel}" value="Cancel"/>
              
Error is Error: Unknown method 'Controller_FTFView.save()'

If i remove the button, the code saves but when i try and add a value into one of my fields it just disappears on refresh of the data so obviously is not being commited to the record.

Please can someone give me some idea as to what i need to do, to do this seemingly simple task in Salesforce??
Hi All,

Please help a struggling newbie (very struggling & very new!). I have an Apex Class & a VisualForce page which I believe should work. I am completely failing in writing a test class that gives me anything greater than 0% code coverage in my sandbox.

The basic premise is that I want to display a filtered list of records from my custom object in a visualforce page, the user will then be able to update certain fields, press Save and the records will update.

My apex class & visualforce page (/FTFEdit) code are below (these have been improved by a kind developer on these forums already).

Please, please can a nice kind person help me with a test class that works.

Thanks
Emma
 
public with sharing class Controller_FTFView{
    public List<PD_Record__c> FTFRecords {get; set;}

    public Controller_FTFView(){
        FTFRecords= [
            SELECT Name, Closure_Outcome__c, FTF__c, FTF_Comment__c, FTF_Reason__c, RFA_Number__c,WR_Number__c
            FROM PD_Record__c
            WHERE WMIS_Patch__c Like '11A5%' AND Owner_Is_Me__c = 0 AND Job_Status__c = 'Closed - Successful' AND (Closure_Outcome__c = 'Parts Ordered - In Stock' OR Closure_Outcome__c = 'Parts Ordered - OOS - Is obtainable' or Closure_Outcome__c = 'One Time Buy - Obtainable' or Closure_Outcome__c = 'Safety Reasons i.e. Manufacturer referral' or Closure_Outcome__c = 'Appliance Replacement Rec. (ART)')];
    }

    public PageReference save(){
        try{
            update FTFRRecords;
        }catch(DMLException e){
            //Report DML exceptions to the Apex Page messages element in Visualforce
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Error,e.getMessage()));
        }

        //Returning null for the page reference, directs user back to the same VF page, but rerenders values.
        //Otherwise, you could return another Visualforce page or a link to a record's detail page here as well.
        return null;
    }

    public PageReference cancel(){
        //Return a link to the parent record perhaps or do something else besides return null here
        return null;
    }
}
<apex:page Controller="Controller_FTFView" >
    <apex:sectionHeader title="" subtitle="Mass Edit"/>
    <apex:pageMessages id="messages" />
    <apex:form >
            <apex:pageBlock mode="detail" title="Edit the following records" id="pb">
            <apex:pageBlockButtons >
                <apex:commandButton action="{!save}" value="Save" rerender="pb,messages"/>
                <apex:commandButton action="{!cancel}" value="Cancel" rerender="pb,messages"/>
                 </apex:pageBlockButtons>          
            <apex:pageBlockSection columns="1">
                  <apex:pageBlockTable value="{!FTFRecords}" var="p">
                    <apex:column value="{!p.Name}"/>          
                    <apex:column value="{!p.WR_Number__c}"/>
                    <apex:column value="{!p.RFA_Number__c}"/>
                    <apex:column value="{!p.Closure_Outcome__c}"/>     
                    <apex:column headerValue="FTF?" >                   
                        <apex:inputField value="{!p.FTF__c}"/>
                    </apex:column>
                    <apex:column headerValue="FTF Reason" >                   
                        <apex:inputField value="{!p.FTF_Reason__c}"/>
                    </apex:column>
                    <apex:column headerValue="FTF Comment" >
                        <apex:inputField value="{!p.FTF_Comment__c}"/>
                    </apex:column>                    
                  </apex:pageBlockTable>
       </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>



 
I have a large number of records in Salesforce in a custom object. Each hour we loaded in more records for our users to work on. Sometimes they cannot work on some records so they close them down. This takes a long time to go into each one individually. So i want to give them a list of records based on a certain set of criteria and then they can update each one and click save. Seems simple but i have been tearing my hair out for days. Please help. I am VERY new to Salesforce. Please, please be very specific if you are able to give me guidance.

This is my controller (apex class)

public with sharing class Controller_FTFView{
    Transient public List<PD_Record__c> FTFRecords;
    public List<PD_Record__c> getFTFRecords() {
            FTFRecords= [
            SELECT Name, Closure_Outcome__c, FTF__c, FTF_Comment__c, FTF_Reason__c, RFA_Number__c,WR_Number__c
            FROM PD_Record__c
            WHERE WMIS_Patch__c Like '11A5%' AND Owner_Is_Me__c = 0 AND Job_Status__c = 'Closed - Successful' AND (Closure_Outcome__c = 'Parts Ordered - In Stock' OR Closure_Outcome__c = 'Parts Ordered - OOS - Is obtainable' or Closure_Outcome__c = 'One Time Buy - Obtainable' or Closure_Outcome__c = 'Safety Reasons i.e. Manufacturer referral' or Closure_Outcome__c = 'Appliance Replacement Rec. (ART)')];
        return FTFRecords;
    }
}

This is my visual force page

<apex:page Controller="Controller_FTFView" >
    <apex:sectionHeader title="" subtitle="Mass Edit"/>
    <apex:pageMessages />
    <apex:form >
            <apex:pageBlock mode="detail" title="Edit the following records" >
            <apex:pageBlockButtons >
                <apex:commandButton action="{!save}" value="Save"/>
                <apex:commandButton action="{!cancel}" value="Cancel"/>
                 </apex:pageBlockButtons>          
            <apex:pageBlockSection columns="1">
                  <apex:pageBlockTable value="{!FTFRecords}" var="p">
                    <apex:column value="{!p.Name}"/>          
                    <apex:column value="{!p.WR_Number__c}"/>
                    <apex:column value="{!p.RFA_Number__c}"/>
                    <apex:column value="{!p.Closure_Outcome__c}"/>     
                    <apex:column headerValue="FTF?" >                   
                        <apex:inputField value="{!p.FTF__c}"/>
                    </apex:column>
                    <apex:column headerValue="FTF Reason" >                   
                        <apex:inputField value="{!p.FTF_Reason__c}"/>
                    </apex:column>
                    <apex:column headerValue="FTF Comment" >
                        <apex:inputField value="{!p.FTF_Comment__c}"/>
                    </apex:column>                    
                  </apex:pageBlockTable>
       </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>

It does not like these buttons                

<apex:commandButton action="{!save}" value="Save"/>
<apex:commandButton action="{!cancel}" value="Cancel"/>
              
Error is Error: Unknown method 'Controller_FTFView.save()'

If i remove the button, the code saves but when i try and add a value into one of my fields it just disappears on refresh of the data so obviously is not being commited to the record.

Please can someone give me some idea as to what i need to do, to do this seemingly simple task in Salesforce??