• Pat Wimsatt
  • NEWBIE
  • 70 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 11
    Questions
  • 7
    Replies
I would swear my test was working before but now it's not and I can't figure out why.  Thoughts?  Here's my test... pretty simple. 

This process works in my Sandbox, it just want test properly when I try to push it to prod. 


@isTest
public class RetrieveLaneDetailTest {
     
    @isTest public static void lanerates() {
        LaneDetailCon laneDetail = new LaneDetailCon();
        PageReference page = laneDetail.executeSearch();
        System.assert(true);
    }
}

Here's my controller:  
public with sharing class LaneDetailCon {
    
    public String oCity { get; set; }
    public String dCity { get; set; }
    public String rType { get; set; }
    public Boolean searched {get; set;}
    
    public List<Lane_Detail__C> lanes { get; set; }
        
public LaneDetailCon(){ 
    searched=false;    
        String orCity = ApexPages.currentPage().getParameters().get('oCity');
        String dsCity = ApexPages.currentPage().getParameters().get('dCity'); 
        String recType = ApexPages.currentPage().getParameters().get('rType');   
        if (null!=orCity)
        {
            oCity = orCity;
            dCity = dsCity;
            rType = recType;
            executeSearch();
        }
    }
    
public PageReference executeSearch(){
    searched=true;
        
           lanes =  [SELECT id, Origin_City__c, Origin_Statess__c, Destination_City__c, Destination_States__c, Rate__c, 
                             RecordTypeId, Rate_10K__c, Rate_30K__c, CPBD_10K__c, CPBD_30K__c,
                             Opportunity__r.Name, Opportunity__r.AccountId, Opportunity__r.Date_Quoted__c, Opportunity__r.StageName 
                     FROM Lane_Detail__c
                     WHERE Origin_City__c = :oCity AND Destination_City__c = :dCity AND RecordTypeId = :rType
                     Order By Opportunity__r.Date_Closed__c Desc
                     LIMIT 25]; 

        return null;
    }
}
 
How do you close a question as answered in this forum?
I'm stuck - again. LOL  I have an Apex page and Controller that I need to upload to Production. I have validated that it works correctly. However, to upload to Production it has to pass that "Test" condition and I don't know how to write it. I am not a C# guy.  Here is my controller, what would a test class look like?

public with sharing class LaneDetailCon {
    
    public String oCity { get; set; }
    public String dCity { get; set; }
    public Boolean searched {get; set;}
    
    public List<Lane_Detail__C> lanes { get; set; }
        
public LaneDetailCon(){ 
    searched=false;    
        String orCity = ApexPages.currentPage().getParameters().get('oCity');
        String dsCity = ApexPages.currentPage().getParameters().get('dCity');   
        if (null!=orCity)
        {
            oCity = orCity;
            dCity = dsCity;
            executeSearch();
        }
    }
    
public PageReference executeSearch(){
    searched=true;
     //   System.debug('The origin city is ' + oCity);
     //      System.debug('The destination city is ' + dCity);
        
           lanes =  [SELECT id, Origin_City__c, Origin_Statess__c, Destination_City__c, Destination_States__c, Rate__c, 
                     Opportunity__r.Name, Opportunity__r.AccountId, Opportunity__r.Date_Quoted__c, Opportunity__r.StageName 
                     FROM Lane_Detail__c
                     WHERE Origin_City__c = :oCity AND Destination_City__c = :dCity 
                     Order By Opportunity__r.Date_Closed__c Desc
                     LIMIT 25]; 
      //  System.debug('The SOQL is ' + lanes);
        return null;
    }
}
I am trying to pass a parameter to a controller.  I have this block in my page:
                <apex:outputText>
                    <apex:param name="thisParam" assignTo="{!CityO}" value="{!$CurrentPage.parameters.oCity}" />
                </apex:outputText>

Then my controller has this:

public class LaneDetailCon {

    public static String CityO { get; set; }
    
    public PageReference setParams() 
    {
        return null;
    }

    static List<Lane_Detail__c> lanes { get; set; }
 
    public static List<Lane_Detail__c> getLanes()
    {          
           System.debug('The origin city is ' + CityO);
            



There are no errors, thus the code executes, however, my paramater OCity returns as null.  What does the apex:param action not pass the variable to OCity?
Our Sales team has a custom Object called Lane Details.  On the page layout for this object I created a custom button to open a Visualforce page.  That vf page has a controller that goes out and pulls records to display in a list form. That list needs a parameter from the Lane Details page.  I can't seem to pass the parameter from the 1st page to the Controller so that it returns the selected criteria.  I have tried both of these... where origin_city__c is the custom field that the controller needs to use to pull the correct records.  

System.currentPageReference().getParameters().get('origin_city__c');
Apex.currentPage().getParameters().get('origin_city__c');

Here is the controller:

public class LaneDetailCon {
 
    static List<Lane_Detail__c> lanes;
 
    public static List<Lane_Detail__c> getLanes() {
        
            String ocity  = System.currentPageReference().getParameters().get('origin_city__c');
            System.debug(ocity);
       
            lanes = [SELECT id, Origin_City__c, Origin_Statess__c, Destination_City__c,
                     Destination_States__c, Rate__c FROM Lane_Detail__c 
                     WHERE Origin_City__c = :ocity
                     LIMIT 25];
        return lanes;
    }
 }


I do NOT need an inputField or inputText in my output.  The user will not be editting nor entering data. They just need to see a list of the records based on the query in the controller.
In the above example, the variable ocity returns null because by then the second page has rendered and the field no longer exists.

I hope this makes sense. I really need to get this working. Thank you. 


 
Any idea why this is throwing an error:  Error: Could not resolve the entity from <apex:inputField> value binding '{!lanes.origin_city__c}'. <apex:inputField> can only be used with SObjects, or objects that are Visualforce field component resolvable.


my vfp file...
<apex:form >   
        <apex:pageBlock title="OD List" id="od_list" mode="edit">
        
        
            <apex:pageBlockSection title="My Content Section" columns="2">
                <apex:inputField value="{!lanes.origin_city__c}"/>
                <apex:inputField value="{!lanes.origin_statess__c }"/>
                <apex:inputField value="{!lanes.Destination_City__c }"/>
                <apex:inputField value="{!lanes.Destination_States__c}"/>
            </apex:pageBlockSection>       
        

Here's my controller:
public class LaneDetailCon {
 
    static List<Lane_Detail__c> lanes;
 
    public static List<Lane_Detail__c> getLanes() {
        
            String City  = ApexPages.currentPage().getParameters().get('origin_city__c');
        
            lanes = [SELECT Origin_City__c, Origin_Statess__c, Destination_City__c,
                     Destination_States__c, Rate__c FROM Lane_Detail__c 
                     WHERE Origin_City__c = :City 
                     LIMIT 25];
        return lanes;
    }
 }
When we create an opportunity to ship, we have a child record for origin/destinations. There can be many many child records to show starts and stops. Any way the user can enter several at a time rather than one at a time?  Even with the Save and New button it's still very inefficient. 
Is it possible to hide fields on a template?  Perhaps by using javascript?  I am new to the Salesforce platform but I know it can be done in Dynamics so I understand the concept.  Based on some condition a field's visibility property is either turned on or turned off. 
 
Hi,  I know what I want to do but not sure how to get there.  We of course have an Opportunity Object OOB in Salesforce.  We also have a related Object we call LaneDetails that displays where a shipment is originating and ending.   It's a one to many relationship.   When a user creates a new Opportunity, let's say from Chicago to New Orleans,  I want a "pop-up" window or iFrame to display other LaneDetails that went from Chicago to New Orleans so the user has a concept of how we priced the trip before.   How would I do that?  Use a Visual Source page with a DataTable?  How would I trigger it to open and display?  Any help is appreciated. 
 
I am trying my first attempt at Visualforce pages.  I found a sample online and it works fine, but when I change it to use my custom objects, it fails. Here's what I have and getting an error on the page saying "Unknown property 'dataTableLanes.lanes'.  It clearly exists.  What am I missing?

The Class:
public class dataTableLanes {
    List<Lane_Detail__c> lanes;
 
    public List<Lane_Detail__c> getLaneDetails() {
        if(lanes == null)
            lanes = [SELECT Destination_City__c, Destination_States__c FROM Lane_Detail__c LIMIT 10];
        return lanes;
    }
}


The Page:

<apex:page controller="dataTableLanes" id="thePage">
    <apex:dataTable value="{!lanes}" var="lane" id="theTable"
        rowClasses="odd,even" styleClass="tableClass">
        <apex:facet name="caption">table caption</apex:facet>
        <apex:facet name="header">table header</apex:facet>
        <apex:facet name="footer">table footer</apex:facet>
 
        <apex:column>
            <apex:facet name="header">Name</apex:facet>
            <apex:facet name="footer">column footer</apex:facet>
            <apex:outputText value="{!lane.Destination_City__c}"/>
        </apex:column>
 
        <apex:column>
            <apex:facet name="header">Owner</apex:facet>
            <apex:facet name="footer">column footer</apex:facet>
            <apex:outputText value="{!lane.Destination_States__c}"/>
        </apex:column>
 
    </apex:dataTable>
</apex:page>
Hello, I have an email template with the following layout.  All the field display properly except the OD Sets fields and I can't figure out why.  Can anyone suggest what I may do to fix the issue? 

Email Template
Hello, I have an email template with the following layout.  All the field display properly except the OD Sets fields and I can't figure out why.  Can anyone suggest what I may do to fix the issue? 

Email Template
I am trying to pass a parameter to a controller.  I have this block in my page:
                <apex:outputText>
                    <apex:param name="thisParam" assignTo="{!CityO}" value="{!$CurrentPage.parameters.oCity}" />
                </apex:outputText>

Then my controller has this:

public class LaneDetailCon {

    public static String CityO { get; set; }
    
    public PageReference setParams() 
    {
        return null;
    }

    static List<Lane_Detail__c> lanes { get; set; }
 
    public static List<Lane_Detail__c> getLanes()
    {          
           System.debug('The origin city is ' + CityO);
            



There are no errors, thus the code executes, however, my paramater OCity returns as null.  What does the apex:param action not pass the variable to OCity?
Any idea why this is throwing an error:  Error: Could not resolve the entity from <apex:inputField> value binding '{!lanes.origin_city__c}'. <apex:inputField> can only be used with SObjects, or objects that are Visualforce field component resolvable.


my vfp file...
<apex:form >   
        <apex:pageBlock title="OD List" id="od_list" mode="edit">
        
        
            <apex:pageBlockSection title="My Content Section" columns="2">
                <apex:inputField value="{!lanes.origin_city__c}"/>
                <apex:inputField value="{!lanes.origin_statess__c }"/>
                <apex:inputField value="{!lanes.Destination_City__c }"/>
                <apex:inputField value="{!lanes.Destination_States__c}"/>
            </apex:pageBlockSection>       
        

Here's my controller:
public class LaneDetailCon {
 
    static List<Lane_Detail__c> lanes;
 
    public static List<Lane_Detail__c> getLanes() {
        
            String City  = ApexPages.currentPage().getParameters().get('origin_city__c');
        
            lanes = [SELECT Origin_City__c, Origin_Statess__c, Destination_City__c,
                     Destination_States__c, Rate__c FROM Lane_Detail__c 
                     WHERE Origin_City__c = :City 
                     LIMIT 25];
        return lanes;
    }
 }
Is it possible to hide fields on a template?  Perhaps by using javascript?  I am new to the Salesforce platform but I know it can be done in Dynamics so I understand the concept.  Based on some condition a field's visibility property is either turned on or turned off. 
 
Hi,  I know what I want to do but not sure how to get there.  We of course have an Opportunity Object OOB in Salesforce.  We also have a related Object we call LaneDetails that displays where a shipment is originating and ending.   It's a one to many relationship.   When a user creates a new Opportunity, let's say from Chicago to New Orleans,  I want a "pop-up" window or iFrame to display other LaneDetails that went from Chicago to New Orleans so the user has a concept of how we priced the trip before.   How would I do that?  Use a Visual Source page with a DataTable?  How would I trigger it to open and display?  Any help is appreciated. 
 
I am trying my first attempt at Visualforce pages.  I found a sample online and it works fine, but when I change it to use my custom objects, it fails. Here's what I have and getting an error on the page saying "Unknown property 'dataTableLanes.lanes'.  It clearly exists.  What am I missing?

The Class:
public class dataTableLanes {
    List<Lane_Detail__c> lanes;
 
    public List<Lane_Detail__c> getLaneDetails() {
        if(lanes == null)
            lanes = [SELECT Destination_City__c, Destination_States__c FROM Lane_Detail__c LIMIT 10];
        return lanes;
    }
}


The Page:

<apex:page controller="dataTableLanes" id="thePage">
    <apex:dataTable value="{!lanes}" var="lane" id="theTable"
        rowClasses="odd,even" styleClass="tableClass">
        <apex:facet name="caption">table caption</apex:facet>
        <apex:facet name="header">table header</apex:facet>
        <apex:facet name="footer">table footer</apex:facet>
 
        <apex:column>
            <apex:facet name="header">Name</apex:facet>
            <apex:facet name="footer">column footer</apex:facet>
            <apex:outputText value="{!lane.Destination_City__c}"/>
        </apex:column>
 
        <apex:column>
            <apex:facet name="header">Owner</apex:facet>
            <apex:facet name="footer">column footer</apex:facet>
            <apex:outputText value="{!lane.Destination_States__c}"/>
        </apex:column>
 
    </apex:dataTable>
</apex:page>

Today we’re excited to announce the new Salesforce Developers Discussion Forums. We’ve listened to your feedback on how we can improve the forums.  With Chatter Answers, built on the Salesforce1 Platform, we were able to implement an entirely new experience, integrated with the rest of the Salesforce Developers site.  By the way, it’s also mobile-friendly.

We’ve migrated all the existing data, including user accounts. You can use the same Salesforce account you’ve always used to login right away.  You’ll also have a great new user profile page that will highlight your community activity.  Kudos have been replaced by “liking” a post instead and you’ll now be able to filter solved vs unsolved posts.

This is, of course, only the beginning  and because it’s built on the Salesforce1 Platform, we’re going to be able to bring you more features faster than ever before.  Be sure to share any feedback, ideas, or questions you have on this forum post.

Hats off to our development team who has been working tirelessly over the past few months to bring this new experience to our community. And thanks to each of you for helping to build one of the most vibrant and collaborative developer communities ever.