• goose
  • NEWBIE
  • 0 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 6
    Replies
Hi,

I'm looking for saleforce/visualforce/apex developers in the Lisbon area of Portugal. Must be fluent English speakers.

Thanks
  • November 13, 2008
  • Like
  • 0
Hi,
 
I created a couple of very simple triggers on my development account - but not using eclipse, just the standard web interface tools. They successfully past testing and I uploaded the related package to the production system.
 
However, in the production system they are marked as inactive and cannot be edited. I read in the boards this is normal but I can't see how to set them active without starting to use eclipse. Is there a simpler way to do this?
 
Thanks
  • October 28, 2008
  • Like
  • 0
Hi,

I've been running around in circles a bit on this one.

What I would like to do is set the company field (required) on a new lead to be the lead's lastname+firstname if it is not entered.

I first tried using a before insert trigger but it failed on validation of the field not being empty - so it looks as if the required field validations of non-custom fields are run before triggers.

Next I found this code suggestion:

http://community.salesforce.com/sforce/board/message?board.id=ajax_toolkit&message.id=7009

which bascailly says on bringing up the new lead forn, auto-populate the required field with some predetermined text that can be substituted out in the before insert trigger.

And so I overrode the new button for leads with the suggested s-control to generate the URL:

https://na6.salesforce.com/00Q/e?retURL=%2F00Q%2Fo&Company=test&nooverride=1

But the Company field is still blank rather than 'test'.

Is this because you cannot pass parameters to non-custom forms or have I done something wrong?

Any suggestions welcome.

Thanks
  • October 01, 2008
  • Like
  • 0
Hi,

I'm trying to write a class that can be called from two separate triggers. It works for one but not the other and I cant see why:

I have a custom object - flight__c - that is a child object of accounts. One of the custom fields of flight__c is flight_hours and the trigger sums up all the flight hours of completed flights and puts the sum in a custom field of the parent account.

I couldn't use roll-up summary as the formula includes a filter on another of the flight custom fields.

The class is:

Code:
public class sumFlightHours {
   public static void getTotals(Account[] accs) {
      for (Account acc : accs) {
         Double tot = 0;
         for (Flight__c flight : [select id, Flight__c.Flight_hours__c from Flight__c where Flight__c.Flight_Account__c = :acc.id and Flight_status__c ='Flown']) {
            tot += flight.Flight_hours__c;
         }
         acc.Hours_used__c = tot;
      }
   }
}

 Now - with a trigger added to accounts, any changes to an account record will re-sum the flight records.

Code:
trigger updateHoursFlown on Account (before update, before insert) {
    sumFlightHours.getTotals(Trigger.new);
}

 
This works fine. (You might ask why is there such a trigger on accounts and not just on flights, but I plan to modify the sum later to include editable account fields in the formula so any changes in these will be needed).

However, a trigger added to flights does not work and I cant see why? This trigger pulls out the parent accounts for the affected flights and runs the same class method.

Code:
trigger updateParentHoursFlown on Flight__c (after update, after insert) {
Account[] accs = new Account[0];
for (Flight__c flight : Trigger.new) {
    for (Account acc : [select id from Account where id = :flight.Flight_Account__c]) {
        accs.add(acc);
        }
    }
sumFlightHours.getTotals(accs);
}

 
In this trigger, I use 'after' as I assume it needs the flights written to the database before the summation occurs. But there are no errors, it's just that the summary is not adjusted - not until editing the parent account when the other trigger does it's job for it.

Can anybody see what I've done wrong?

Thanks

  • September 22, 2008
  • Like
  • 0
Hi,

I've written a wizard for updating a custom object.

What I cannot see to do is call the wizard with a parameter that - when passed - will set the an object variable within the wizard.

For example. i have a custom object; Flight__c. On a particular flight's detail page, I want to add a button that will call a custom visualforce page with that flight's id passed as a parameter. eg: na6.salesforce.com/apex/testpage?id=00000SA1Q

In that page - testpage - there is a form that will allow some of that record's values to be edited:

Code:
<apex:page controller="bookingWizController">
  <apex:sectionHeader title="Confirm Flight Booking" subtitle="Step 0 of 7"/>
    <apex:form >
      <apex:pageBlock title="Define Flight Name" mode="edit">
        <apex:pageBlockButtons >
            <apex:commandButton action="{!step1}" value="Next"/>
        </apex:pageBlockButtons>
        <apex:pageBlockSection title="Test set Flight">
            <apex:outputField id="flight" value="{!flight.name}"/>
        </apex:pageBlockSection>
        <apex:pageBlockSection title="Test pick account">
            <apex:inputField id="account" value="{!flight.Flight_Account__c}" required="true"/>
        </apex:pageBlockSection>        
        <apex:pageBlockSection title="Test pick dep airport">
            <apex:inputField id="dep_airport" value="{!flight.Flight_departure_airport__c}" required="true"/>
        </apex:pageBlockSection>     
        <apex:pageBlockSection title="Test pick arr airport">
            <apex:inputField id="arr_airport" value="{!flight.Flight_arrivals_airport__c}" required="true"/>
        </apex:pageBlockSection>
    </apex:pageBlock>
  </apex:form>
</apex:page>

and the controller get:

Code:
   public Flight__c getFlight() {   
      if(flight == null) flight = new Flight__c();
      return flight;
   }

 
and the rest of the methods are for various 'prev', 'next' and 'save' buttons - together with getters and setters for other objects. I just can't see where the flight can be initially set from the id paramater.

I'm probably missing something obvious - so a pointer would be really appreciated.

Thanks
 

  • September 20, 2008
  • Like
  • 0
Hi,

I have a problem with som code I'm developing. I'm not sure if it's down to my apex code, visualforce code or something else - so thought it best to post it here. Sorry if it's the wrong place.

I'm writing a visualforce wizard - based on the standard sample wizard in the documentation: http://wiki.apexdevnet.com/index.php/NewOpportunityController.apex

Most of it seems to be working though the problem is when selecting a number of contacts via a "apex:selectCheckboxes". On this wizard page, both the prev and next buttons return to the current page and not the pages appropriate.

Rather than post the whole code, here's samples;

The button controller code is:


Code:
   public PageReference step0() {
      return Page.bookingwiz0;
   }

   public PageReference step1() {
      return Page.bookingwiz1;
   }

   public PageReference step2() {
      return Page.bookingwiz2;
   }

 
Page bookingwiz0 has the vf code:


Code:
<apex:page controller="bookingWizController">
  <apex:sectionHeader title="Confirm Flight Booking" subtitle="Step 0 of 7"/>
    <apex:form >
      <apex:pageBlock title="Define Flight Name" mode="edit">
        <apex:pageBlockButtons >
            <apex:commandButton action="{!step1}" value="Next"/>
        </apex:pageBlockButtons>
        <apex:pageBlockSection title="Set Flight">
            <apex:inputField id="flight" value="{!flight.name}"/>
        </apex:pageBlockSection>
        <apex:pageBlockSection title="Test pick account">
            <apex:inputField id="account" value="{!flight.Flight_Account__c}"/>
        </apex:pageBlockSection>
    </apex:pageBlock>
  </apex:form>
</apex:page>

 
- which works fine. The 'getters' (I believe is the term) in the controller are:

Code:
   Account account;
Flight__c flight;

public Account getAccount() {
if(account == null) account = new Account();
return account;
} public Flight__c getFlight() { if(flight == null) flight = new Flight__c(); return flight; }

 

Now, the problem is with the next page. This picks a list of passengers from the account's contacts. (They will later be assigned to the flight as m:m objects but for now, they are just stored in the controller as an array of contacts).

Code:
<apex:page controller="bookingWizController">
  <apex:sectionHeader title="Confirm Flight Booking" subtitle="Step 1 of 7"/>
    <apex:form >
      <apex:pageBlock title="Add Passengers" mode="edit">
        <apex:pageBlockButtons >
        
            <apex:commandButton action="{!step0}" value="Previous"/>
            <apex:commandButton action="{!step2}" value="Next"/>
        </apex:pageBlockButtons>
            <apex:pageBlockSection title="Available Passengers" columns="1">
                <apex:selectCheckboxes value="{!passengers}" layout="pageDirection">
                    <apex:selectOptions value="{!passengeritem}"/>
                </apex:selectCheckboxes>
            </apex:pageBlockSection>
    </apex:pageBlock>
  </apex:form>
</apex:page>

 Now, I did a similar getter and got a read only error message. So I searched for the problem and the solution seemed to be to create a setter too:

Code:
   Contact[] passengers;

   public Contact[] getPassengers() {
       return passengers;
   }
   
   public void setPassengers(Contact[] passengers) {
        this.passengers = passengers;
   }




public List<SelectOption> passengeritemList;

public List<SelectOption> getPassengeritem() {
if (passengeritemList== null) {
List<Contact> contcs= [select id,firstname,lastname from Contact where Contact.Account.id = :flight.Flight_account__c];

passengeritemList= new List<SelectOption>();
for (Contact c : contcs) {
passengeritemList.add(new SelectOption(c.id, c.lastname + ' ' +c.firstname));
}
}
return passengeritemList;
}

 

It behaves as expected on page '0' - but on going to page '1' - either selecting or not selecting contacts from the list - neither the previous or next buttons go to the previous or next pages. The screen is rerendered - so it looks like the buttons are working - but it re-appears on page '1'.

Any ideas folks?

Thanks



  • September 20, 2008
  • Like
  • 0
Hi,


A little while ago I saw a visualforce demo with a calendar view included (I think it was for vacation booking).

Does anyone know of an example of code for displaying date related objects on a calendar?

Thanks.
  • September 08, 2008
  • Like
  • 0
Hi,

New to salesforce. I'm trying to implement a system which involves a transport booking system. There are quite a few custom objects such as vehicles, agents, offices, staff etc - which appear straightforward to implement within the standard app setup. However, with implementing the booking themselves, I'd like to add functionality similar to salesforce activities.

A 'trip' is assigned to an account - and can be related to contacts and various other custom objects. It has three possible states: query, booking and historical-record.

As a trip progresses, it starts as a query, is 'promoted' to a booking and finally becomes a historical-record when the trip is complete and the vehicle is returned.

The change of state could be done manually - either changing a dropdown - or hitting a button. But I'd like them to be displayed in three seperate subpanels under an account detail record - progressing from one to the next and the next as their states change (trip query, trip booking and trip history). Similar to how calls or meetings are moved from 'open activities' to 'activity history' as they are completed.

Any thoughts or recommendations on the best way to progress with this?

Thanks
  • September 02, 2008
  • Like
  • 0
Hi,

I'm trying to write a class that can be called from two separate triggers. It works for one but not the other and I cant see why:

I have a custom object - flight__c - that is a child object of accounts. One of the custom fields of flight__c is flight_hours and the trigger sums up all the flight hours of completed flights and puts the sum in a custom field of the parent account.

I couldn't use roll-up summary as the formula includes a filter on another of the flight custom fields.

The class is:

Code:
public class sumFlightHours {
   public static void getTotals(Account[] accs) {
      for (Account acc : accs) {
         Double tot = 0;
         for (Flight__c flight : [select id, Flight__c.Flight_hours__c from Flight__c where Flight__c.Flight_Account__c = :acc.id and Flight_status__c ='Flown']) {
            tot += flight.Flight_hours__c;
         }
         acc.Hours_used__c = tot;
      }
   }
}

 Now - with a trigger added to accounts, any changes to an account record will re-sum the flight records.

Code:
trigger updateHoursFlown on Account (before update, before insert) {
    sumFlightHours.getTotals(Trigger.new);
}

 
This works fine. (You might ask why is there such a trigger on accounts and not just on flights, but I plan to modify the sum later to include editable account fields in the formula so any changes in these will be needed).

However, a trigger added to flights does not work and I cant see why? This trigger pulls out the parent accounts for the affected flights and runs the same class method.

Code:
trigger updateParentHoursFlown on Flight__c (after update, after insert) {
Account[] accs = new Account[0];
for (Flight__c flight : Trigger.new) {
    for (Account acc : [select id from Account where id = :flight.Flight_Account__c]) {
        accs.add(acc);
        }
    }
sumFlightHours.getTotals(accs);
}

 
In this trigger, I use 'after' as I assume it needs the flights written to the database before the summation occurs. But there are no errors, it's just that the summary is not adjusted - not until editing the parent account when the other trigger does it's job for it.

Can anybody see what I've done wrong?

Thanks

  • September 22, 2008
  • Like
  • 0
Hi,

I've written a wizard for updating a custom object.

What I cannot see to do is call the wizard with a parameter that - when passed - will set the an object variable within the wizard.

For example. i have a custom object; Flight__c. On a particular flight's detail page, I want to add a button that will call a custom visualforce page with that flight's id passed as a parameter. eg: na6.salesforce.com/apex/testpage?id=00000SA1Q

In that page - testpage - there is a form that will allow some of that record's values to be edited:

Code:
<apex:page controller="bookingWizController">
  <apex:sectionHeader title="Confirm Flight Booking" subtitle="Step 0 of 7"/>
    <apex:form >
      <apex:pageBlock title="Define Flight Name" mode="edit">
        <apex:pageBlockButtons >
            <apex:commandButton action="{!step1}" value="Next"/>
        </apex:pageBlockButtons>
        <apex:pageBlockSection title="Test set Flight">
            <apex:outputField id="flight" value="{!flight.name}"/>
        </apex:pageBlockSection>
        <apex:pageBlockSection title="Test pick account">
            <apex:inputField id="account" value="{!flight.Flight_Account__c}" required="true"/>
        </apex:pageBlockSection>        
        <apex:pageBlockSection title="Test pick dep airport">
            <apex:inputField id="dep_airport" value="{!flight.Flight_departure_airport__c}" required="true"/>
        </apex:pageBlockSection>     
        <apex:pageBlockSection title="Test pick arr airport">
            <apex:inputField id="arr_airport" value="{!flight.Flight_arrivals_airport__c}" required="true"/>
        </apex:pageBlockSection>
    </apex:pageBlock>
  </apex:form>
</apex:page>

and the controller get:

Code:
   public Flight__c getFlight() {   
      if(flight == null) flight = new Flight__c();
      return flight;
   }

 
and the rest of the methods are for various 'prev', 'next' and 'save' buttons - together with getters and setters for other objects. I just can't see where the flight can be initially set from the id paramater.

I'm probably missing something obvious - so a pointer would be really appreciated.

Thanks
 

  • September 20, 2008
  • Like
  • 0
Hi,

I have a problem with som code I'm developing. I'm not sure if it's down to my apex code, visualforce code or something else - so thought it best to post it here. Sorry if it's the wrong place.

I'm writing a visualforce wizard - based on the standard sample wizard in the documentation: http://wiki.apexdevnet.com/index.php/NewOpportunityController.apex

Most of it seems to be working though the problem is when selecting a number of contacts via a "apex:selectCheckboxes". On this wizard page, both the prev and next buttons return to the current page and not the pages appropriate.

Rather than post the whole code, here's samples;

The button controller code is:


Code:
   public PageReference step0() {
      return Page.bookingwiz0;
   }

   public PageReference step1() {
      return Page.bookingwiz1;
   }

   public PageReference step2() {
      return Page.bookingwiz2;
   }

 
Page bookingwiz0 has the vf code:


Code:
<apex:page controller="bookingWizController">
  <apex:sectionHeader title="Confirm Flight Booking" subtitle="Step 0 of 7"/>
    <apex:form >
      <apex:pageBlock title="Define Flight Name" mode="edit">
        <apex:pageBlockButtons >
            <apex:commandButton action="{!step1}" value="Next"/>
        </apex:pageBlockButtons>
        <apex:pageBlockSection title="Set Flight">
            <apex:inputField id="flight" value="{!flight.name}"/>
        </apex:pageBlockSection>
        <apex:pageBlockSection title="Test pick account">
            <apex:inputField id="account" value="{!flight.Flight_Account__c}"/>
        </apex:pageBlockSection>
    </apex:pageBlock>
  </apex:form>
</apex:page>

 
- which works fine. The 'getters' (I believe is the term) in the controller are:

Code:
   Account account;
Flight__c flight;

public Account getAccount() {
if(account == null) account = new Account();
return account;
} public Flight__c getFlight() { if(flight == null) flight = new Flight__c(); return flight; }

 

Now, the problem is with the next page. This picks a list of passengers from the account's contacts. (They will later be assigned to the flight as m:m objects but for now, they are just stored in the controller as an array of contacts).

Code:
<apex:page controller="bookingWizController">
  <apex:sectionHeader title="Confirm Flight Booking" subtitle="Step 1 of 7"/>
    <apex:form >
      <apex:pageBlock title="Add Passengers" mode="edit">
        <apex:pageBlockButtons >
        
            <apex:commandButton action="{!step0}" value="Previous"/>
            <apex:commandButton action="{!step2}" value="Next"/>
        </apex:pageBlockButtons>
            <apex:pageBlockSection title="Available Passengers" columns="1">
                <apex:selectCheckboxes value="{!passengers}" layout="pageDirection">
                    <apex:selectOptions value="{!passengeritem}"/>
                </apex:selectCheckboxes>
            </apex:pageBlockSection>
    </apex:pageBlock>
  </apex:form>
</apex:page>

 Now, I did a similar getter and got a read only error message. So I searched for the problem and the solution seemed to be to create a setter too:

Code:
   Contact[] passengers;

   public Contact[] getPassengers() {
       return passengers;
   }
   
   public void setPassengers(Contact[] passengers) {
        this.passengers = passengers;
   }




public List<SelectOption> passengeritemList;

public List<SelectOption> getPassengeritem() {
if (passengeritemList== null) {
List<Contact> contcs= [select id,firstname,lastname from Contact where Contact.Account.id = :flight.Flight_account__c];

passengeritemList= new List<SelectOption>();
for (Contact c : contcs) {
passengeritemList.add(new SelectOption(c.id, c.lastname + ' ' +c.firstname));
}
}
return passengeritemList;
}

 

It behaves as expected on page '0' - but on going to page '1' - either selecting or not selecting contacts from the list - neither the previous or next buttons go to the previous or next pages. The screen is rerendered - so it looks like the buttons are working - but it re-appears on page '1'.

Any ideas folks?

Thanks



  • September 20, 2008
  • Like
  • 0
Hi,


A little while ago I saw a visualforce demo with a calendar view included (I think it was for vacation booking).

Does anyone know of an example of code for displaying date related objects on a calendar?

Thanks.
  • September 08, 2008
  • Like
  • 0
Hi,

New to salesforce. I'm trying to implement a system which involves a transport booking system. There are quite a few custom objects such as vehicles, agents, offices, staff etc - which appear straightforward to implement within the standard app setup. However, with implementing the booking themselves, I'd like to add functionality similar to salesforce activities.

A 'trip' is assigned to an account - and can be related to contacts and various other custom objects. It has three possible states: query, booking and historical-record.

As a trip progresses, it starts as a query, is 'promoted' to a booking and finally becomes a historical-record when the trip is complete and the vehicle is returned.

The change of state could be done manually - either changing a dropdown - or hitting a button. But I'd like them to be displayed in three seperate subpanels under an account detail record - progressing from one to the next and the next as their states change (trip query, trip booking and trip history). Similar to how calls or meetings are moved from 'open activities' to 'activity history' as they are completed.

Any thoughts or recommendations on the best way to progress with this?

Thanks
  • September 02, 2008
  • Like
  • 0