• laytro1978
  • NEWBIE
  • 25 Points
  • Member since 2009

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 19
    Questions
  • 26
    Replies

Hi,

 

I have a quick question.  I have two visualforce pages which effectivley PDF the same record in two different formats.  They are activated by two buttons on the object.  The format used is based on a field.  Instead of having two buttons I just want one, which would force some logic (guessing APEX controller) to first look at the field and if it was a certain value it would choose format 1, if it was another value it would choose format 2.  Can anyone point me in the right direction.  Any code snippets or examples would be great.

Hi,

 

This code pulls back via a VF page availability within date range (start and end date).  It list room allocations which as an object has a lookup to a room record on the room object..  

 

I would like to run a second query based on the first.

 

For the rooms that a brought back i.e rooms allocated I would like to bring back a separate list rooms not allocated.  Room__c highlighted below is the lookup to the room__c object.

 

So I think using the list of room allocation from the first query I will know the room__c for each record.  I want to use the room_c name against the room object to show rooms that are not in that list.

 

So on the VF page I will have two list rooms allocated and rooms not allocated within a give date range.

 

Any help would be great.

 

Thanks

 

Ross

 

 

Public class Roommanager {

    public PageReference room() {
        return null;
    }

    public Room_Allocation__c room {get;set;}
    public roommanager(ApexPages.StandardController controller) {
           room=(Room_Allocation__c)controller.getRecord();
             }
            
    public List<Room_Allocation__c> getRooms(){
            List<Room_Allocation__c> listBd=[select Id, Name, Start_Date__c, End_Date__c, Nights__c, Room__c, Reservation__c from Room_Allocation__c r 
                where (Start_Date__c >= :room.Search_Start_Date__c 
                    and 
                    Start_Date__c <= :room.Search_End_Date__c
                    )
                    or
                    (End_Date__c >= :room.Search_Start_Date__c
                    and
                    End_Date__c <= :room.Search_End_Date__c)];  
            return listBd;   
        }
}

 

 

Had some help to get to this point but I can't seem to get the code below to work.

 

Just looking for a list view which will search start dates after the user inputs a date.

 

The VF page looks okay but I just can't get the controller to work, any help would be great as I am really stuck.

 

Thanks

 

Ross

 


Error: Resmanager Compile Error: Illegal assignment from SObject to SOBJECT:Reservation__c at line 4 column 12

 

 

 

Apex Controller

Made some changes to your code highlighted in red.  

 

public class Resmanager {
    public Reservation__c reservation {get;set;}
    public Resmanager(ApexPages.StandardController controller) {
           reservation=controller.getRecord();
             }
            
    public List<Reservation__c> getReservations(){
            List<Reservation__c> listBd=[select r.id, r.Start_Date__c, R.End_Date__c, nights__c from Reservation__c r where start_date__c = :reservation.Start_Date__c];
            return listBd;   
        }
    public void save()
    {
    getReservation();
     }
}

 

Visualforce Page

<apex:page standardController="Reservation__c"  extensions="Resmanager">
    <apex:form >
        <apex:sectionHeader title="Availability Search"/>            
            <apex:pageBlock title="Search">
                <apex:pageBlockButtons >
                    <apex:commandButton action="{!reservation}" value="Search"/>
                </apex:pageBlockButtons>
                <apex:inputField value="{!Reservation__c.Start_Date__c}"/>
            </apex:pageBlock>  
            <apex:pageBlock title="Reservations">
                <apex:pageBlockSection >
                    <apex:pageBlockTable value="{!Reservations}" var="res">
                        <apex:column value="{!res.Start_Date__c}"  />
                        <apex:column value="{!res.End_Date__c}"  />
                        <apex:column value="{!res.Nights__c}"  />
                    </apex:pageBlockTable>
                </apex:pageBlockSection>   
            </apex:pageBlock> 
    </apex:form>
</apex:page>

 

 

Hi,

 

I would like to build a VF page which pulls back a list of all opportunities with a certain close date.

 

Are there any good guides or starter code.

 

Simple VF page with a date search box, it search and it pulls back the opportunities.

 

Thanks

 

R

Hi,

 

Quick question.  I have a client that wants to move to a force.com license.

 

This means he will lose lead and lead capture.

 

I can easily re-create the lead object, but how easy is it to recreate the lead capture I guess using apex and visualforce.

 

Thanks

 

Ross

Hi Simon,

 

I have a user who has just installed maildrop.

 

Using a mac with office 2011 outlook.

 

He tries to send an email into the system and gets the following error.

 

unknown.png

 

Can you please help.

 

Thanks

 

Ross

I have custom object with a

 

 

  1. name (unique)
  2. start date
  3. end date
I want create a VF / Apex availability checker to see where there are no records with the same name and date.
Any help much appreciated.
Thanks
R

 

Background

A friend  runs a small hotel, 8 rooms.  He wanted me to help him with CRM which I did with SFDC.  We are now looking to try and build a simple reservation manager to be used be his receptionist.   The reservation manager should allow the receptionist to make bookings, change and delete them.

 

What I have done so far

I have two objects room and reservation.  The reservation has a lookup to contact and room.  So I can create a reservation with a start and an end date.  So at a glance I can see room booking either as a report, a list view or as a related list on the room object.

 

Help

I now want to make the system more intelligent. 

 

 

  1. Validation to stop duplicate bookings

  2. A Visualforce page with Apex that would allow the receptionist to quickly see what is available. With the possibility of applying filters like en-suite or balcony

  3. Being able to split the booking should a client want to change room halfway through there stay
My thoughts
I think I need a third object (hidden) called room allocation, which is created using APEX automatically when a reservation is made. The room allocation records would be per booking so if somebody was staying at the hotel for 3 days there would be 3 allocation records
Final comment
I am doing this as a favour for a friend so no real budget.  Although I thinking of buying calendar anything from the Appexchange to visualise my room bookings.  Also I am treating this as a learning project.
Any help / pointers / suggestions welcome.  I did think there might be so sample meeting manager apps to get ideas from but no such luck!

 

Hi,

 

Can someone please give me a hand on the test method for this piece of APEX.

 

Any help would be much appreciated.

 

I have made a start in red below.

 

Thanks

 

Ross

 

 

public class TimeEntry {

    public List<Time_Slot__c> slots {get; set;}
    
    public TimeEntry(){        
        slots = new List<Time_Slot__c>();
        slots.add(new Time_Slot__c());
    }

    public void addrow() {
        slots.add(new Time_Slot__c());
    }
           
    public void removerow(){
        Integer i = slots.size();
        slots.remove(i-1);
    }
           
    public PageReference save() {
        insert slots;
        PageReference home = new PageReference('/a00/o');
        home.setRedirect(true);
        return home;
    }
    
    public static testMethod void TimeEntry() {

    //setup test data  
    Time_Slot__c T = new Time_Slot__c();
    insert t;
    
    //test main controller action 
    List<Time_Slot__c> slots;
          
    }       
}

 

 

We have resources (meeting rooms) in outlook and salesforce.com.

 

Ideally I want to sync both outlook and salesforce.com.

 

Is this possible.

 

We need salesforce.com and non-salesforce.com users to be able to see an up to date picture of resource calendars which may have been booked in salesforce or in outlook.

 

Thanks

 

Ross

 

 

Hi,

 

Just watched the Spring 11 video.

 

In it they talk about Flows and Firefly Illustrator Desktop.

 

Does anyone know how I can download this applicaiton.

 

I have a Spring 11 Sandbox but there is no Flows option under setup > Workflows & Approvals

 

Thanks

 

R

Does anyone know if the resources calendars are customisable.

 

I would like to a resource called Room 1, but I would also like to record the size of the room and what facilities it has i.e internet connection, style.

 

Also does anyone have any pointers on creating a visualforce page with the invite calendar section from the event object.

 

Ideally I would like to see a month calendar view with all of the rooms different colours so I can easily see availability.

 

Thanks

 

Ross

Hi,

 

I have a room object, and related booking object.

 

The booking object has a start date and end date.

 

I'd like to write a piece of validation which would stop someone from taking a room which already have a booking on the same date.

 

Any pointers would be welcome, for various reason I can't use the standard resources on activities.

 

Thanks

 

Ross

Hi,

 

I am building a room booking manager.

 

The objects are in place, I now need to create a visualforce form which will allow a user to search for a certain type of room.

 

It's very similar to lookup filters, the kind of thing is a page that has search criteria at the top and results at the bottom.

 

So, search would be room size, does it have a projector, start date & time, end date & time.

 

When this is put in the results would show what is available that meets the criteria.

 

Any pointers would be welcome.

 

p.s I have tried to use resource calendars but I need to show attributes i.e projector room size in the search.

Hi,

 

We are looking to build an app to manage our meeting rooms, there are only 4 with different assets / sizes in one location.

 

Un-happily we don't have a budget for this one so I am building internally from scratch and we don't need anything sophistcated.

 

I can build the room object but am having difficult to think of the best way to show the bookings.

 

Ideally a user will search to see if a room is available.

 

Days and times should be shown as blocked out if the room is already booked.

 

Any thought starters would be welcome.

 

Thanks

 

Ross

Hi

 

Anyone have any tips of salesforce to salesforce child record sharing, details below;

 

 

  • I have a connection to another org
  • We both share and publish lead and tasks
  • Both have the same fields mapped and published
Salesforce to salesforce is suppose to automatically share child records.  So if I have a lead (which I have shared) and add an activity it should show up in the other org.  But it does not, I have to manually forward the task as well.
Any advice would be welcome.
Thanks
Ross

 

 

Below is an extension that brings back contact roles that are related to an account and have a type = Board Member.  The extension is called from a visualforce page which is triggered by a button on an account page the results are displayed in a table on the page - this bit works well.:smileyhappy:

  

For the contacts retrieved I need to perform an additional query to see what other board member contact roles they have and display them in a separate table.

 

Example 

 

So query 1 would bring back Joe Bloggs who is a board member of ABC Co. And Jane Doe who is a board member of ABC Co.

 

I need query 2 to use Joe and Janes contact ID and search to find any contact roles that have a type of board member and are not ABC Co.

 

Not sure how to join these statements, any suggestions welcome - thanks in advance.

 

 

 

public with sharing class AccountListExtension { private final Account acct; public AccountListExtension(ApexPages.StandardController controller) { this.acct = (Account)controller.getRecord(); } public List<Contact_Role__c> getBoardmembers(){ List<Contact_Role__c> listBd = [Select c.id, c.contact__r.name, c.title__c, c.State__c, c.primary_account__c from Contact_Role__c c where c.account__r.Id = :this.acct.Id and c.Contact_Role__c='Board Member']; return listBd; }}

 

 

 

So I have a visualforce page that is a redesigned account page layout using a standard controller.

On the page amongst other things I show a list of contact roles in a table.  Some contacts have roles with many accounts .  Ideally I want to show in one column a list of all the other accounts a contact has roles with.

 

For example

 

Name Role Other memberships

Joe Bloggs  Sales ABC Co, XYZ Co, Bloggs Co, etc......

 

I can render the table but can't work out the logic required to show all of the accounts in the other membership column.

 

Any suggestions welcome, thanks in advance.

 

 

Hi,

 

Not sure the best way to go about this all ideas welcome.

 

I have a custom object called contact roles, it allows more functionality than the standard object.

 

The custom contact role object allows me to link a contact to an account.

 

On the account page I want to create a visual force page that brings back all the linked contacts and all of the accounts they are linked to.

 

For example I have Joe Bloggs who is linked to ABC company and XYZ company.  When I go onto ABC company I see a button called contact roles.  This would open a visual force page show Joe Bloggs associated to ABC company and it also needs to show what other companies such as XYS he is linked to.

 

Thanks in advance 

Hi,

 

This code pulls back via a VF page availability within date range (start and end date).  It list room allocations which as an object has a lookup to a room record on the room object..  

 

I would like to run a second query based on the first.

 

For the rooms that a brought back i.e rooms allocated I would like to bring back a separate list rooms not allocated.  Room__c highlighted below is the lookup to the room__c object.

 

So I think using the list of room allocation from the first query I will know the room__c for each record.  I want to use the room_c name against the room object to show rooms that are not in that list.

 

So on the VF page I will have two list rooms allocated and rooms not allocated within a give date range.

 

Any help would be great.

 

Thanks

 

Ross

 

 

Public class Roommanager {

    public PageReference room() {
        return null;
    }

    public Room_Allocation__c room {get;set;}
    public roommanager(ApexPages.StandardController controller) {
           room=(Room_Allocation__c)controller.getRecord();
             }
            
    public List<Room_Allocation__c> getRooms(){
            List<Room_Allocation__c> listBd=[select Id, Name, Start_Date__c, End_Date__c, Nights__c, Room__c, Reservation__c from Room_Allocation__c r 
                where (Start_Date__c >= :room.Search_Start_Date__c 
                    and 
                    Start_Date__c <= :room.Search_End_Date__c
                    )
                    or
                    (End_Date__c >= :room.Search_Start_Date__c
                    and
                    End_Date__c <= :room.Search_End_Date__c)];  
            return listBd;   
        }
}

 

 

Had some help to get to this point but I can't seem to get the code below to work.

 

Just looking for a list view which will search start dates after the user inputs a date.

 

The VF page looks okay but I just can't get the controller to work, any help would be great as I am really stuck.

 

Thanks

 

Ross

 


Error: Resmanager Compile Error: Illegal assignment from SObject to SOBJECT:Reservation__c at line 4 column 12

 

 

 

Apex Controller

Made some changes to your code highlighted in red.  

 

public class Resmanager {
    public Reservation__c reservation {get;set;}
    public Resmanager(ApexPages.StandardController controller) {
           reservation=controller.getRecord();
             }
            
    public List<Reservation__c> getReservations(){
            List<Reservation__c> listBd=[select r.id, r.Start_Date__c, R.End_Date__c, nights__c from Reservation__c r where start_date__c = :reservation.Start_Date__c];
            return listBd;   
        }
    public void save()
    {
    getReservation();
     }
}

 

Visualforce Page

<apex:page standardController="Reservation__c"  extensions="Resmanager">
    <apex:form >
        <apex:sectionHeader title="Availability Search"/>            
            <apex:pageBlock title="Search">
                <apex:pageBlockButtons >
                    <apex:commandButton action="{!reservation}" value="Search"/>
                </apex:pageBlockButtons>
                <apex:inputField value="{!Reservation__c.Start_Date__c}"/>
            </apex:pageBlock>  
            <apex:pageBlock title="Reservations">
                <apex:pageBlockSection >
                    <apex:pageBlockTable value="{!Reservations}" var="res">
                        <apex:column value="{!res.Start_Date__c}"  />
                        <apex:column value="{!res.End_Date__c}"  />
                        <apex:column value="{!res.Nights__c}"  />
                    </apex:pageBlockTable>
                </apex:pageBlockSection>   
            </apex:pageBlock> 
    </apex:form>
</apex:page>

 

 

Hi,

 

Struggling on this, I would like a custom list view with a dynamic date field search.  Below is a visualforce page which is all set-up just how I want it. I am using the action save clearly this needs to be a search method.

 

 

<apex:page standardController="Reservation__c"  extensions="Resmanager">
    <apex:form >
        <apex:sectionHeader title="Availability Search"/>            
            <apex:pageBlock title="Search">
                <apex:pageBlockButtons >
                    <apex:commandButton action="{save}" value="Search"/>
                </apex:pageBlockButtons>
                <apex:inputField value="{!Reservation__c.Start_Date__c}"/>
            </apex:pageBlock>  
            <apex:pageBlock title="Reservations">
                <apex:pageBlockSection >
                    <apex:pageBlockTable value="{!Reservations}" var="res">
                        <apex:column value="{!res.Start_Date__c}"  />
                        <apex:column value="{!res.End_Date__c}"  />
                        <apex:column value="{!res.Nights__c}"  />
                    </apex:pageBlockTable>
                </apex:pageBlockSection>   
            </apex:pageBlock> 
    </apex:form>
</apex:page>

 

I am not sure how to write the search method, my attempt on the controller below.  I am hardcoding yesterday to get the controller to work.

 

 

public class Resmanager { 

    public Resmanager(ApexPages.StandardController controller) {

    }
        
    public List<Reservation__c> getReservations(){
        List<Reservation__c> listBd=[select r.id, r.Start_Date__c, R.End_Date__c, nights__c from Reservation__c r where start_date__c = yesterday];
        return listBd;   
    }
   
}

 

 

 

Hi,

 

I would like to build a VF page which pulls back a list of all opportunities with a certain close date.

 

Are there any good guides or starter code.

 

Simple VF page with a date search box, it search and it pulls back the opportunities.

 

Thanks

 

R

Hi,

 

Quick question.  I have a client that wants to move to a force.com license.

 

This means he will lose lead and lead capture.

 

I can easily re-create the lead object, but how easy is it to recreate the lead capture I guess using apex and visualforce.

 

Thanks

 

Ross

Hi Simon,

 

I have a user who has just installed maildrop.

 

Using a mac with office 2011 outlook.

 

He tries to send an email into the system and gets the following error.

 

unknown.png

 

Can you please help.

 

Thanks

 

Ross

Below is a simple VF page and Controller. You will not on the Controller I hard code the

 

 

where nights__c = 4

 

 I want to make this dynamic using a input field on the VF page.

 

 

 

VF Page

 

 

<apex:page controller="Resmanager">
    <apex:sectionHeader title="Availability Search"/> 
                 
              <apex:pageBlock title="Reservations">
              <apex:pageBlockSection >
                    <apex:pageBlockTable value="{!Reservations}" var="res">
                        <apex:column value="{!res.Start_Date__c}"  />
                        <apex:column value="{!res.End_Date__c}"  />
                        <apex:column value="{!res.Nights__c}"  />
                    </apex:pageBlockTable>
               </apex:pageBlockSection>
               
               </apex:pageBlock>

</apex:page>

 

 

APEX Controller

 

 

public class Resmanager {
    
    public List<Reservation__c> getReservations(){
        List<Reservation__c> listBd=[select r.id, r.Start_Date__c, R.End_Date__c, nights__c from Reservation__c r where nights__c = 4];
        return listBd;   
    }
   
}

 

 

 

I have custom object with a

 

 

  1. name (unique)
  2. start date
  3. end date
I want create a VF / Apex availability checker to see where there are no records with the same name and date.
Any help much appreciated.
Thanks
R

 

Background

A friend  runs a small hotel, 8 rooms.  He wanted me to help him with CRM which I did with SFDC.  We are now looking to try and build a simple reservation manager to be used be his receptionist.   The reservation manager should allow the receptionist to make bookings, change and delete them.

 

What I have done so far

I have two objects room and reservation.  The reservation has a lookup to contact and room.  So I can create a reservation with a start and an end date.  So at a glance I can see room booking either as a report, a list view or as a related list on the room object.

 

Help

I now want to make the system more intelligent. 

 

 

  1. Validation to stop duplicate bookings

  2. A Visualforce page with Apex that would allow the receptionist to quickly see what is available. With the possibility of applying filters like en-suite or balcony

  3. Being able to split the booking should a client want to change room halfway through there stay
My thoughts
I think I need a third object (hidden) called room allocation, which is created using APEX automatically when a reservation is made. The room allocation records would be per booking so if somebody was staying at the hotel for 3 days there would be 3 allocation records
Final comment
I am doing this as a favour for a friend so no real budget.  Although I thinking of buying calendar anything from the Appexchange to visualise my room bookings.  Also I am treating this as a learning project.
Any help / pointers / suggestions welcome.  I did think there might be so sample meeting manager apps to get ideas from but no such luck!

 

Hi,

 

I have need to roll up data from one object to another but cannot use a master detail relationship.

 

I have an object called project and an object called time sheet.

 

When a timesheet is created and linked to project I want to sum all related time sheet records.

 

I would usually use a master detail relationship but I can't lock timesheet to project as timesheets can be agains most objects.

 

Is there an easy way every time a time sheet is added to project to have a field - total time spent calculate?

 

Thanks

 

Ross

Hi,

 

Can someone please give me a hand on the test method for this piece of APEX.

 

Any help would be much appreciated.

 

I have made a start in red below.

 

Thanks

 

Ross

 

 

public class TimeEntry {

    public List<Time_Slot__c> slots {get; set;}
    
    public TimeEntry(){        
        slots = new List<Time_Slot__c>();
        slots.add(new Time_Slot__c());
    }

    public void addrow() {
        slots.add(new Time_Slot__c());
    }
           
    public void removerow(){
        Integer i = slots.size();
        slots.remove(i-1);
    }
           
    public PageReference save() {
        insert slots;
        PageReference home = new PageReference('/a00/o');
        home.setRedirect(true);
        return home;
    }
    
    public static testMethod void TimeEntry() {

    //setup test data  
    Time_Slot__c T = new Time_Slot__c();
    insert t;
    
    //test main controller action 
    List<Time_Slot__c> slots;
          
    }       
}