• DevilJ
  • NEWBIE
  • 25 Points
  • Member since 2010

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

Hello Everyone,

 

I need some  help with a bit of apex code.  I am creating a query list that I need to check to see if it is empty.

 

Here is my code:

if (oldPhoneName != null){
    	 List<Transportation_Services__c> oldRecord = [Select Name, Pickup_Time__c, Client__r.Last_Name__c,  Pickup_Location__r.Name,
        Drop_Off_Location__r.Name, Phone_Name__c, Notes_Transportation__c from Transportation_Services__c 
        WHERE Pickup_Time__c = TODAY AND Phone_Name__c = :oldPhoneName AND Name != :valueTwo Order by Pickup_Time__c];
        if(oldRecord.isEmpty){
        	createXML(record, oldPhoneName, true);
        }else{
        	createXML(oldRecord, oldphoneName, false);
        }
    } 

 

 

Apex does not like my 'records.isEmpty'.  I get this error on compile:  

Save error: Initial term of field expression must be a concrete SObject: LIST<Transportation_Services__c>  

 

Does anyone know of a way that I can check if a SOQL generated list came back with no records (empty)?

 

Thanks.

  • April 21, 2011
  • Like
  • 0

Hello,

 

I am needing help on a bit of code.  I am trying to make a call to a controller method from a apex:selectList drop down menu.  I want the code to send the value chosen in the dropdown menu (parameter) to the method on a "onchange" event.  I read a blog that showed how to make a call to an apex:actionFunction and then there forward the parameter to the controller method.  This works fine if I pas a test string, however, I have no idea on how to capture my dropdown selectionlist item into a variable and send it to the function.  If anyone could help, it would be appreciated.  Here is my code:

<apex:page tabstyle="Transportation_Services__c" controller="goGetScheduleQuery">
    <apex:form >
    <apex:actionFunction name="update" action="{!updateSchedule}" rerender="jsvalues">
            <apex:param name="phone" value="" />
                    </apex:actionFunction>
    <apex:pageblock > 
    <apex:pageBlockButtons >
        <apex:commandButton value="Schedule A Pickup" action="{!schedulePickup}"/>
        
        <apex:commandButton value="View the Map" action="{!mapPage}"/>
        </apex:pageBlockButtons>
        <apex:pageblocktable value="{!schedule}"  var="event" columnsWidth="75px,75px,75px,75px,75px,300px">
            <apex:column value="{!event.Pickup_Time__c}"/>
            <apex:column value="{!event.Client__c}"/>
            <apex:column value="{!event.Pickup_Location__c}"/>
            <apex:column value="{!event.Drop_off_Location__c}"/>
            <apex:column headerValue="Phone">
            <apex:selectList id="phoneChoice" value="{!event.Phone_Name__c}"  size="1" title="Phones" onchange="update('test selection')">
            <apex:selectOptions value="{!phones}" ></apex:selectOptions>
            </apex:selectList>
            </apex:column>
            <apex:column value="{!event.Notes_Transportation__c}"/>
            <apex:column value="{!event.Name}" rendered="no"/>
        </apex:pageblocktable>
        <apex:outputPanel id="jsvalues">
            <apex:outputText value="Value one: {!valueOne}" /><br/>
            <apex:outputText value="Value two: {!valueTwo}" /><br />           
        </apex:outputPanel>
    </apex:pageblock>
    </apex:form>
</apex:page>

 

 

  • April 01, 2011
  • Like
  • 0

Hello,

 

I have created a wizard for a custom client object.  Following the example in the Visualforce guide, I created this method to cancel the edit:

 

 

public PageReference cancel() {   PageReference clientPage = new ApexPages.StandardController(client).view();   clientPage.setRedirect(true);   return clientPage;    }

 

 

I created a similar method for the save() method and it works great.

 

The problem I am having is when I hit cancel, my page throws errors for all the fields that require validation.  Is their a way to do a cancel from a custom controller that would just cancel much like the standardcontroller {!cancel} method?

 

Thanks,

 

DevilJ

  • November 22, 2010
  • Like
  • 0

Hello,

 

I am trying to create a trigger that will create an event that is assigned to two users.  The event is recurring.  I have read that the you cannot manually create EventAttendee records.  Does anyone know of a way to create an even in Apex that will automatically create a group event with more than one attendee?

  • October 25, 2010
  • Like
  • 0

Hello,

 

I am a newbie to force.com.  I am building an app that will help schedule disability services for a college and I have a few questions.  I have created an object that would assign an interpreter to a certain student at a certain time (class).  I have decided to use a custom object called interpreter service to record each assignment but I would like to use the event object so I can use the built in calendar features in force.com.  I see that the event object has a related to field which I can set to the interpreter service.  In essence, the records in the interpreter service entity will have a one to one relation with records in the event entity.  I have created a trigger that creates a corresponding event when an interpreting service is created.  I have two problems. One, is there a way to set the 'related to' field in an event so it is connected to its corresponding Interpreting service record. And second, is their a way to make the event record a dependent child of the corresponding interpreter service record, allowing cascading deletes?

 

Thanks

  • October 02, 2010
  • Like
  • 0

Hello Everyone,

 

I need some  help with a bit of apex code.  I am creating a query list that I need to check to see if it is empty.

 

Here is my code:

if (oldPhoneName != null){
    	 List<Transportation_Services__c> oldRecord = [Select Name, Pickup_Time__c, Client__r.Last_Name__c,  Pickup_Location__r.Name,
        Drop_Off_Location__r.Name, Phone_Name__c, Notes_Transportation__c from Transportation_Services__c 
        WHERE Pickup_Time__c = TODAY AND Phone_Name__c = :oldPhoneName AND Name != :valueTwo Order by Pickup_Time__c];
        if(oldRecord.isEmpty){
        	createXML(record, oldPhoneName, true);
        }else{
        	createXML(oldRecord, oldphoneName, false);
        }
    } 

 

 

Apex does not like my 'records.isEmpty'.  I get this error on compile:  

Save error: Initial term of field expression must be a concrete SObject: LIST<Transportation_Services__c>  

 

Does anyone know of a way that I can check if a SOQL generated list came back with no records (empty)?

 

Thanks.

  • April 21, 2011
  • Like
  • 0

Hello,

 

I am needing help on a bit of code.  I am trying to make a call to a controller method from a apex:selectList drop down menu.  I want the code to send the value chosen in the dropdown menu (parameter) to the method on a "onchange" event.  I read a blog that showed how to make a call to an apex:actionFunction and then there forward the parameter to the controller method.  This works fine if I pas a test string, however, I have no idea on how to capture my dropdown selectionlist item into a variable and send it to the function.  If anyone could help, it would be appreciated.  Here is my code:

<apex:page tabstyle="Transportation_Services__c" controller="goGetScheduleQuery">
    <apex:form >
    <apex:actionFunction name="update" action="{!updateSchedule}" rerender="jsvalues">
            <apex:param name="phone" value="" />
                    </apex:actionFunction>
    <apex:pageblock > 
    <apex:pageBlockButtons >
        <apex:commandButton value="Schedule A Pickup" action="{!schedulePickup}"/>
        
        <apex:commandButton value="View the Map" action="{!mapPage}"/>
        </apex:pageBlockButtons>
        <apex:pageblocktable value="{!schedule}"  var="event" columnsWidth="75px,75px,75px,75px,75px,300px">
            <apex:column value="{!event.Pickup_Time__c}"/>
            <apex:column value="{!event.Client__c}"/>
            <apex:column value="{!event.Pickup_Location__c}"/>
            <apex:column value="{!event.Drop_off_Location__c}"/>
            <apex:column headerValue="Phone">
            <apex:selectList id="phoneChoice" value="{!event.Phone_Name__c}"  size="1" title="Phones" onchange="update('test selection')">
            <apex:selectOptions value="{!phones}" ></apex:selectOptions>
            </apex:selectList>
            </apex:column>
            <apex:column value="{!event.Notes_Transportation__c}"/>
            <apex:column value="{!event.Name}" rendered="no"/>
        </apex:pageblocktable>
        <apex:outputPanel id="jsvalues">
            <apex:outputText value="Value one: {!valueOne}" /><br/>
            <apex:outputText value="Value two: {!valueTwo}" /><br />           
        </apex:outputPanel>
    </apex:pageblock>
    </apex:form>
</apex:page>

 

 

  • April 01, 2011
  • Like
  • 0

Hello,

 

I have created a wizard for a custom client object.  Following the example in the Visualforce guide, I created this method to cancel the edit:

 

 

public PageReference cancel() {   PageReference clientPage = new ApexPages.StandardController(client).view();   clientPage.setRedirect(true);   return clientPage;    }

 

 

I created a similar method for the save() method and it works great.

 

The problem I am having is when I hit cancel, my page throws errors for all the fields that require validation.  Is their a way to do a cancel from a custom controller that would just cancel much like the standardcontroller {!cancel} method?

 

Thanks,

 

DevilJ

  • November 22, 2010
  • Like
  • 0

Hello,

 

I am a newbie to force.com.  I am building an app that will help schedule disability services for a college and I have a few questions.  I have created an object that would assign an interpreter to a certain student at a certain time (class).  I have decided to use a custom object called interpreter service to record each assignment but I would like to use the event object so I can use the built in calendar features in force.com.  I see that the event object has a related to field which I can set to the interpreter service.  In essence, the records in the interpreter service entity will have a one to one relation with records in the event entity.  I have created a trigger that creates a corresponding event when an interpreting service is created.  I have two problems. One, is there a way to set the 'related to' field in an event so it is connected to its corresponding Interpreting service record. And second, is their a way to make the event record a dependent child of the corresponding interpreter service record, allowing cascading deletes?

 

Thanks

  • October 02, 2010
  • Like
  • 0