• gbrown17
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 4
    Replies

Hi,


I'm having difficulty understanding where I went wrong when creating the apex class.  I'm getting an error on line 12 - unexpected token: 'ApexPages.currentPage'.  

 

Can someone shed some light on this for me?


Thanks,

Greg

public class aseAuditPDFController
{
	public Credit__c__c getCredit()
    {
        //Retrieve Credit Application based on Id parameter of this page
        return [Select Id,
                Credit__c.Financial_Data__c,
                Credit__c.Forecast_Sales_per_Month__c,
                Credit__c.Customer_Type__c
                from Credit__c j
                where Id= 
ApexPages.currentPage().getParameters().get('id')];

    }
}

 

Hi,

 

I'm trying to create a public class that will search my object (production__c) by a phone number and display values of the custom object.

I want this controller to run on a VF page where all data in the object can be searched by the phone number.

 

I have some apex code that i've been tweaking, but it's not working.  The code I wrote is searching by the name.  I can always tweak it for a phone number on my own.

 

Can someone please shed some light on why this isn't working.  Bear with me, I'm a noob.

 

 public class VehicleStatusLookup {
public List<production__c> status{get;set;}
public List<production__c> getstatus(){
return status;
}
public production__c getstatus(){
Id id=system.currentpagereference().getparameters().get('id');
return id == null ? new production__c() : [SELECT Id, Name
FROM Production__c
WHERE Id = :id];
}
public String statusname { get; set; }
public String statusId { get; set; }

public PageReference search() {


if(statusId.length()>0)
{
string stdid='select id, name,Production__c,Status__c,Location__c from production__C where name=:statustId';
status=Database.Query(stdid);
if(status.size()==0)
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,'Vehicle Not Found'));
return null;
}
if(statusname.length()>0)
{
string stdname='select id,name,Production__c,Status__c,Location__c from production__C where Production__C LIKE \'' + Statusname+ '%\'';
status=Database.Query(stdname);
if(status.size()==0)
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,'Vehicle Not Found'));
return null;
}
if((statusId.length()>0)&&(statusname.length()>0))
{
string std='select id,name,Production__c,Status__c,Location__c where name=:statusId';
status=Database.Query(std);
return null;
}
else
{
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,'Please Enter Any Value'));
return null;
}
}
}

 

 

 

Thanks,


Greg

 

 

Let me start off by saying I've searched high and low for an answer on the boards and the web and I still came up empty handed.

 

I'm having difficulty creating an Apex controller.  My intention is to use the controller so new records can be submitted on a publicly available force.com site by Guest Usrers, essentially a web to to lead but to my custom object Agent_Portal__c.

 

I'm receiving two errors when I implement the controller on my VF page.  They are Error: Unknown Property 'AgentPortalCreateController.Agent_Portal__c' and then it gives me two links to Create Apex property 'AgentPortalCreateController.Agent_Portal__c' and Create Apex method 'AgentPortalCreateController.getAgent_Portal__c'.  I click on the links hoping that it will fix the problem but then I get two error Invalid identifier: getAgent_Portal__c and Invalid identifier:Agent_Portal__c when I click on both links.

 

Any insight how I can fix this?

 

Visualforce Code:

<apex:page Controller="AgentPortalCreateController" showHeader="false">
            
    <apex:form >
    
     <apex:pageBlock >
         <apex:pageBlockButtons >
         <apex:commandButton action="{!save}" value="Submit"/>
         </apex:pageBlockButtons>    
           
            <apex:pageBlockSection title="Referral Information" columns="1">   
            <apex:pageBlockSection >
            <apex:inputField value="{!Agent_Portal__c.Insured_s_Name__c}"/>
            </apex:pageBlockSection>
         
            <apex:pageBlockSection >
            <apex:inputField value="{!Agent_Portal__c.Insured_s_Phone__c}"/>
            </apex:pageBlockSection>
         
            <apex:pageBlockSection columns="1" >
            <apex:inputField value="{!Agent_Portal__c.Agency_Name__c}" required="true"/>
            </apex:pageblocksection>
           
            <apex:pageBlockSection >
            <apex:inputField value="{!Agent_Portal__c.Agency_Contact__c}"/>
            </apex:pageBlockSection>
           
             <apex:pageBlockSection >
            <apex:inputField value="{!Agent_Portal__c.Insurance_Company__c}"/>
            </apex:pageBlockSection>
          
            <apex:pageBlockSection >
            <apex:inputField value="{!Agent_Portal__c.Rental_Coverage__c}"/>
            </apex:pageBlockSection>
           
            <apex:pageBlockSection >
            <apex:inputField value="{!Agent_Portal__c.Additional_Comments__c}"/>
            </apex:pageBlockSection>
           
                
            <apex:pageBlockSection >
            <apex:inputField value="{!Agent_Portal__c.Location__c}"/>
            </apex:pageBlockSection>
           
           </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
    </apex:page>

 

 

Controller:

 

public with sharing class AgentPortalCreateController {
  // the referral record you are adding values to
 
  public Agent_Portal__c referral {
    get {
      if (referral == null)
        referral = new Agent_Portal__c();
      return referral;
    }
    set;
  }
   
    public AgentPortalCreateController() {
    // blank constructor
  }
// save button is clicked
 
     public PageReference save() {
try {
      insert referral; // inserts the new record into the database
    } catch (DMLException e) {
      ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Error creating new contact.'));
      return null;
    }
      // if successfully inserted new contact, then displays the thank you page.
    return Page.Contact_Create_Thankyou;
}
}

Hey everyone, I'm still new to Visualforce, I've created a couple pages but I've run in to a problem where the page is not displaying correctly. When I edit the page in development mode, everything looks fine but when I view the page on the site (http://collisionmax.force.com/agentsportal110), it only shows the first field. Any idea why this is happening?

 

Here is my code -

 

<apex:page standardController="Agent_Portal__c" showHeader="false">
    <apex:image value="http://www.collisionmaxagents.com/NE-Philadelphia.jpg"></apex:image>
    
    <apex:form >
        <apex:pageBlock mode="New">
            <apex:pageBlockSection title="Referral Information" columns="1">    
            <apex:pageBlockSection >
            <apex:inputField value="{!Agent_Portal__c.Insured_s_Name__c}"/>
            </apex:pageBlockSection>
          
            <apex:pageBlockSection >
            <apex:inputField value="{!Agent_Portal__c.Insured_s_Phone__c}"/>
            </apex:pageBlockSection>
          
            <apex:pageBlockSection columns="1" >
            <apex:inputField value="{!Agent_Portal__c.Agency_Name__c}" required="true"/>
            </apex:pageblocksection>
            
            <apex:pageBlockSection >
            <apex:inputField value="{!Agent_Portal__c.Agency_Contact__c}"/>
            </apex:pageBlockSection>
            
             <apex:pageBlockSection >
            <apex:inputField value="{!Agent_Portal__c.Insurance_Company__c}"/>
            </apex:pageBlockSection>
           
            <apex:pageBlockSection >
            <apex:inputField value="{!Agent_Portal__c.Rental_Coverage__c}"/>
            </apex:pageBlockSection>
            
            <apex:pageBlockSection >
            <apex:inputField value="{!Agent_Portal__c.Additional_Comments__c}"/>
            </apex:pageBlockSection>
            
           </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
    </apex:page>

 

 

Thanks,

Greg

I'm hoping someone could help me out. I'm trying to display attachments (pictures) in a VF page that are attached to a record. I have searched for a solution on the boards but none of them have seemed to work. Any suggestions? Much appreciated. Thanks, Greg

Hi,


I'm having difficulty understanding where I went wrong when creating the apex class.  I'm getting an error on line 12 - unexpected token: 'ApexPages.currentPage'.  

 

Can someone shed some light on this for me?


Thanks,

Greg

public class aseAuditPDFController
{
	public Credit__c__c getCredit()
    {
        //Retrieve Credit Application based on Id parameter of this page
        return [Select Id,
                Credit__c.Financial_Data__c,
                Credit__c.Forecast_Sales_per_Month__c,
                Credit__c.Customer_Type__c
                from Credit__c j
                where Id= 
ApexPages.currentPage().getParameters().get('id')];

    }
}

 

Let me start off by saying I've searched high and low for an answer on the boards and the web and I still came up empty handed.

 

I'm having difficulty creating an Apex controller.  My intention is to use the controller so new records can be submitted on a publicly available force.com site by Guest Usrers, essentially a web to to lead but to my custom object Agent_Portal__c.

 

I'm receiving two errors when I implement the controller on my VF page.  They are Error: Unknown Property 'AgentPortalCreateController.Agent_Portal__c' and then it gives me two links to Create Apex property 'AgentPortalCreateController.Agent_Portal__c' and Create Apex method 'AgentPortalCreateController.getAgent_Portal__c'.  I click on the links hoping that it will fix the problem but then I get two error Invalid identifier: getAgent_Portal__c and Invalid identifier:Agent_Portal__c when I click on both links.

 

Any insight how I can fix this?

 

Visualforce Code:

<apex:page Controller="AgentPortalCreateController" showHeader="false">
            
    <apex:form >
    
     <apex:pageBlock >
         <apex:pageBlockButtons >
         <apex:commandButton action="{!save}" value="Submit"/>
         </apex:pageBlockButtons>    
           
            <apex:pageBlockSection title="Referral Information" columns="1">   
            <apex:pageBlockSection >
            <apex:inputField value="{!Agent_Portal__c.Insured_s_Name__c}"/>
            </apex:pageBlockSection>
         
            <apex:pageBlockSection >
            <apex:inputField value="{!Agent_Portal__c.Insured_s_Phone__c}"/>
            </apex:pageBlockSection>
         
            <apex:pageBlockSection columns="1" >
            <apex:inputField value="{!Agent_Portal__c.Agency_Name__c}" required="true"/>
            </apex:pageblocksection>
           
            <apex:pageBlockSection >
            <apex:inputField value="{!Agent_Portal__c.Agency_Contact__c}"/>
            </apex:pageBlockSection>
           
             <apex:pageBlockSection >
            <apex:inputField value="{!Agent_Portal__c.Insurance_Company__c}"/>
            </apex:pageBlockSection>
          
            <apex:pageBlockSection >
            <apex:inputField value="{!Agent_Portal__c.Rental_Coverage__c}"/>
            </apex:pageBlockSection>
           
            <apex:pageBlockSection >
            <apex:inputField value="{!Agent_Portal__c.Additional_Comments__c}"/>
            </apex:pageBlockSection>
           
                
            <apex:pageBlockSection >
            <apex:inputField value="{!Agent_Portal__c.Location__c}"/>
            </apex:pageBlockSection>
           
           </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
    </apex:page>

 

 

Controller:

 

public with sharing class AgentPortalCreateController {
  // the referral record you are adding values to
 
  public Agent_Portal__c referral {
    get {
      if (referral == null)
        referral = new Agent_Portal__c();
      return referral;
    }
    set;
  }
   
    public AgentPortalCreateController() {
    // blank constructor
  }
// save button is clicked
 
     public PageReference save() {
try {
      insert referral; // inserts the new record into the database
    } catch (DMLException e) {
      ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Error creating new contact.'));
      return null;
    }
      // if successfully inserted new contact, then displays the thank you page.
    return Page.Contact_Create_Thankyou;
}
}

I'm hoping someone could help me out. I'm trying to display attachments (pictures) in a VF page that are attached to a record. I have searched for a solution on the boards but none of them have seemed to work. Any suggestions? Much appreciated. Thanks, Greg