• hideawayguy
  • NEWBIE
  • 25 Points
  • Member since 2013

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 14
    Questions
  • 20
    Replies

hi folks, i have a dynamic dashboard that runs as the logged in user.

 

i have a master detail relationship between two object. 

 

Master -> Hotel

Detail -> Room Count

 

when i run the report as an admin, all records are counted in the reports as they should be regardless of who owns the master hotel records. however, when i run as a logged in user who owns only one hotel record, the reports that are running are still returning all records in the counts and in the reports. i need it to return only records/data on the report and dashboard for records that are owned by the logged in user (unless admin user is running the report). 

 

any ideas?

 

thanks

 

 

hi folks, 

 

i have a custom calendar that outputs a single calendar month with previous and next buttons that will load up the previous or next months when clicked.  it uses a custom controller for the data. 

 

the boss has decided that he DOES NOT want people to be able to click on the previous month button if the selected month is the current month - ie, you can only see this month and months going forward. so, it's august, and i click through to december of this year, i need the previous button to work when i'm on december so i can go back to august, but when i get to august, i need it to be disabled so i can prevent users from going back in time...

 

if basically want to do something like..

 

if (the calendar month == the acutal month) {

disable the commandlink that rerenders the calendar for the previous month

}

 

i just don't know how to do this in visualforce, or maybe i need to do work in the controller?

 

here's the vf page....

 

<apex:form id="theForm">
<apex:outputPanel id="theCalendar" >

<div class="mCalendar" style="width: 100%;" ><div class="topLeft" ><div class="topRight"/></div>
<div class="body">
<table cellspacing="0" cellpadding="1" border="0">
<tbody>
<tr class="header">
<td><apex:commandLink action="{!prev}" rerender="theCalendar">
<img title="Previous Month" class="prevCalArrow" alt="Previous Month" src="/s.gif" />
</apex:commandLink></td>
<td colspan="5" nowrap="nowrap">
{!month.monthname} {!month.yearname}
</td>
<td><apex:commandLink action="{!next}" rerender="theCalendar">
<img title="Next Month" class="nextCalArrow" alt="Next Month"
src="/s.gif" />
</apex:commandLink></td>
</tr>

<tr>
<th scope="col" class="calDays">SUN</th>
<th scope="col" class="calDays">MON</th>
<th scope="col" class="calDays">TUE</th>
<th scope="col" class="calDays">WED</th>
<th scope="col" class="calDays">THU</th>
<th scope="col" class="calDays">FRI</th>
<th scope="col" class="calDays">SAT</th>
</tr>

<apex:repeat value="{!weeks}" var="wk" id="foreachWeek">
<tr class="days">
<!-- or highlight -->
<apex:repeat value="{!wk.days}" var="day" id="foreachday">
<td valign="top"><a class="{!day.CSSName}"
href="{!day.href}" target="_blank"
title="{!day.title}">{!day.displayValue}</a></td>
</apex:repeat>
</tr>
</apex:repeat>

</tbody>
</table>
</div>
<div class="bottomLeft"><div class="bottomRight"/></div>
</div>

</apex:outputPanel>
</apex:form>

 

any help is greatly appreciated....

 

 

 

hey folks i basically want to do this

 

select Email, FirstName, LastName, Id from Contact where (email address exists more than once in the contact table) order by Email

 

any ideas? 

hi again, 

 

i'm in the very beginning stages of trying to get the activity history from a related object to display in a visual force page - very new to this as i'm sure you'll be able to tell...

 

i have this controller......

 

public class ContactController {

List<Contact> contact;

public List<Contact> getContact() {

if (contact == null) {
contact = [SELECT Id, Name, Email FROM Contact where Id =: '0035000000Zm8Zq'];
}
return contact;
}
}

 

and this vf page that calls it...

 

<apex:page controller="ContactController">

 

<apex:relatedList list="ActivityHistory" ></apex:relatedList>
</apex:page>

 

it displays nothing. i'm wondering if i'm even going about this in the right way? my assumption is that if i return the contact from the controller, i should be able to use the apex related list to display the activity history. 

 

any help/direction is greatly appreciated. 

 

apologies for multiple consecutive posts, but these are issues that have been driving me batty for too long. 

 

so i have a profile that i have used record types to limit the visibility of picklist options. the profile is owner/manager. it works great. the problem is, that i have many owners and managers and their dashboard as it pertains to profiles are pretty much identical expect for which picklist values they should see. i'm wondering/hoping that there is a way to show differnt picklist values to different users without having to create a different profile for each owner/manager who should be seeing something slightly different?

 

anyone come across this issue before? what was your solution?

 

thanks

 

dustin

hello,

 

is there anyway to pass variables to a home page component from data on the usr record? or from a url? i'm have an iframe on a home page component that displays an s control that displays a calendar for a certain group, and based on which group it needs a different id in the url for the iframe to render the proper data. 

 

thank you.

 

dustin

hi folks,

 

i have a custom object, booking__c that has a lookup to contact. i want a related list on booking__c that shows the activity history for the contact. is that possible?

 

thanks

 

dustin

hello again folks.

 

i have a custom object A, with a master detail relationship to custom object B (A master, B Detail). I have another custom object C that has a lookup field to custom object B. 

 

i have added the related list for custom object B to the layout page for custom object C. However, when i associate B to C via the lookup field on object C (mapped to B), it does not show up in the related list on the details page for C.

 

any thought are much appreciated.

 

thanks

 

dustin 

Hi folks, 

 

I have a custom object with a field called source that has a list of 20 master values associated with it. i have created a record type for profile group A. it works just as advertised and restricts the list of values that i assigned when creating a new record. However, for records that existed prior to the creation of the the record types, the list of values in the picklist still contain all of the values from the master list. is there a way to update/assign/unassign the picklist values for the older records?

 

thanks

 

dustin

hi folks this is my first attempt at writing a trigger - not going well! here's what i'm trying to do....

 

i have a custom object called Booking__c that has a lookup field called Commission_Agent__c. 

 

Booking__c is related via lookup to another custom object called Property__c.

 

Property__c has a lookup to a Contact record called Contact_Commission_Agent__c.

 

When a new Booking is created (not every time it's edited, just on creation - or directly after it's created i'm assuming), i need the trigger to lookup the Property__c record via the lookup Field Property__c on Booking__c - then update the Commission_Agent__c field with the id of the Contact_Commission_Agent__c field on the property object. 

 

here's what i have so far. 

 

trigger AssignCommAgent on Booking__c (after insert, before update)
{
//instantiate set to hold unique deployment record ids
Set<Id> bookingIds = new Set<Id>();
for(Booking__c s : Trigger.new)
{
bookingIds.add(s.Property__c);
}

//instantiate map to hold deployment record ids to their corresponding ownerids
Map<Id, Property__c> propertyCommAgentMap = new Map<Id, Property__c>([SELECT Id, Contact_Commission_Agent__c FROM Property__c WHERE Id IN: bookingIds]);

for (Booking__c s : Trigger.new)
{
if (s.Commission_Agent__c == null && propertyCommAgentMap.containsKey(s.Property__c))
{
s.Commission_Agent__c = propertyCommAgentMap.get(s.Property__c).Contact_Commission_Agent__c;
}
}
}

 

here's my error. 

 

Error:Apex trigger AssignCommAgent caused an unexpected exception, contact your administrator: AssignCommAgent: execution of BeforeUpdate caused by: System.NullPointerException: Attempt to de-reference a null object: Trigger.AssignCommAgent: line 17, column 1

 

any insights are greatly appreciated!

Hi folks i have this code that's supposed to be generating some data to be passed to visual force charts. i get this error....

 

Error: Compile Error: Constructor not defined: [PropertyInquiryReports.InqsClass].<Constructor>(Integer, Integer) at line 51 column 29

 

any insights? thanks you. 

 

 

public class PropertyInquiryReports {

 

    public List<AggregateResult> inqs = new List<AggregateResult>();

    

    public PropertyInquiryReports()

    {

 

        String Property_Name = Apexpages.CurrentPage().getParameters().get('Property_Name');

        String dfm = Apexpages.CurrentPage().getParameters().get('dfm');

        String dfy = Apexpages.CurrentPage().getParameters().get('dfy');

        String dtm = Apexpages.CurrentPage().getParameters().get('dtm');

        String dty = Apexpages.CurrentPage().getParameters().get('dty');

        

        Integer dfmC = integer.valueof(dfm);

        Integer dfyC = integer.valueof(dfy);

        Integer dtmC = integer.valueof(dtm);

        Integer dtyC = integer.valueof(dty);

 

        

        Date FromDate = date.newinstance(dfyC, dfmC, 1);

        Date ToDate = date.newinstance(dtyC, dtmC, 31);

 

        AggregateResult[] inqs = 

          

        [SELECT 

         COUNT(Id) theCount, 

         SUM(Reporting_Is_Converted_to_Booking__c) theCountConvertedBooking,

         CALENDAR_YEAR(CreatedDate) theYear,

         CALENDAR_MONTH(CreatedDate) theMonth

                             

         FROM Inquiry__c 

         WHERE Property__r.Name = :Property_Name AND 

         CreatedDate  >: FromDate AND CreatedDate <: ToDate 

            

         GROUP BY CALENDAR_Year(CreatedDate) , CALENDAR_MONTH(CreatedDate)

         ORDER BY  CALENDAR_Year(CreatedDate), CALENDAR_MONTH(CreatedDate) ASC ];

 

    }

 

    public list<InqsClass> getResults()

    {

 

        list<InqsClass> InqsCounts = new list<InqsClass>();

        

            for (AggregateResult ar: inqs)

            { 

 

             Integer the_count = Integer.valueOf(ar.get('theCount'));

             Integer the_count_converted_booking = Integer.valueOf(ar.get('theCountConvertedBooking'));

             String the_month_and_year = Integer.valueOf(ar.get('theYear')) + '-' + Integer.valueOf(ar.get('theMonth));

             InqsCounts.add(new InqsClass(the_count, the_count_converted_booking, the_month_and_year));

            }

                                    

        return InqsCounts;

    }

    

    class InqsClass

    {

            public Integer the_count {get; set;}

            public Integer the_count_converted_booking {get; set;}

public String the_month_and_year {get; set;}

                    

        public InqsClass(AggregateResult ar)

        {

            the_count = (integer)ar.get('theCount');

            the_count_converted_booking = (integer)ar.get('theCountConvertedBooking');

            the_month_and_year = (string)ar.get('the_month_and_year');

        }

 

    }

}

Hi everyone I'm trying to return an aggregate result to pass to visualforce charts with this controller. i need to sum multiple datapoints with different where clauses from the same object.

 

this is the error i get...

 

Error: Compile Error: Didn't understand relationship 'Booking__c' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names. at line 7 column 13

 

Booking__c is the same object as the main query

 

any insights are greatly appreciated

 

public with sharing class BkgPerformance {
public List<AggregateResult> getData() {

 

// return

List<AggregateResult> working =

 

[SELECT COUNT(Id) theCount,
(select count(Id) from Booking__c where Booking_Stage__c = 'Pending') thePending,

(select count(Id) from Booking__c where Booking_Stage__c = '1st Payment'), theFirst,

(select count(Id) from Booking__c where Booking_Stage__c = '2nd Payment'), theSecond,

CALENDAR_YEAR(CreatedDate) theYear


FROM Booking__c

GROUP BY CALENDAR_YEAR(CreatedDate)
ORDER BY CALENDAR_YEAR(CreatedDate)];

 


return (working);

}


}

Hi i have a custom object, widgetSales, that has a related contact (lookup). i've built a visual force email template that pulls data from the widgetSales object. when i press the send email button, i'm taken to the right page but the associated contact is not auto populated with the related contact from the widgetSales object? 

wondering if i'm missing something? 

the vf template relatedTo is set to widgetSales and pulls all the data properly and the recipient type is set to Contact as it should be. it's just not passing in the contact who should receive the email and we have to go through the unnecessary step of looking up the contact every time we want to send an email from the custom object.

any thoughts?

thanks you very much!

 

ps. this is a repost from success.salesforce.com, i thought i was here... 

hi i'm pretty new to visualforce, i'm sure you'll be able to tell. i'm creating a visualforce email template and i need to pull in an apex page that pulls data from a custom object. the code from the apex page looks like this:

 

<apex:page standardController="Inquiry__c">
{!Inquiry__c.Name}
</apex:page>

 

that's being called into the visual force template with an apex include statement. 

 

i ge this error when trying to select the template when trying to send the actual email though:

 

error: Id value 00Y5000000HOTmg is not valid for the Inquiry__c standard controller
 
the relatedto field in the messaging block is as follows.
 
relatedToType="Inquiry__c"
 
it works when i'm not calling in the component and pulls data from the correct objects, but when  i call in the component that is trying to get at the same data, it throws the error. any ideas. thanks in advance!
 

hi folks, 

 

i have a custom calendar that outputs a single calendar month with previous and next buttons that will load up the previous or next months when clicked.  it uses a custom controller for the data. 

 

the boss has decided that he DOES NOT want people to be able to click on the previous month button if the selected month is the current month - ie, you can only see this month and months going forward. so, it's august, and i click through to december of this year, i need the previous button to work when i'm on december so i can go back to august, but when i get to august, i need it to be disabled so i can prevent users from going back in time...

 

if basically want to do something like..

 

if (the calendar month == the acutal month) {

disable the commandlink that rerenders the calendar for the previous month

}

 

i just don't know how to do this in visualforce, or maybe i need to do work in the controller?

 

here's the vf page....

 

<apex:form id="theForm">
<apex:outputPanel id="theCalendar" >

<div class="mCalendar" style="width: 100%;" ><div class="topLeft" ><div class="topRight"/></div>
<div class="body">
<table cellspacing="0" cellpadding="1" border="0">
<tbody>
<tr class="header">
<td><apex:commandLink action="{!prev}" rerender="theCalendar">
<img title="Previous Month" class="prevCalArrow" alt="Previous Month" src="/s.gif" />
</apex:commandLink></td>
<td colspan="5" nowrap="nowrap">
{!month.monthname} {!month.yearname}
</td>
<td><apex:commandLink action="{!next}" rerender="theCalendar">
<img title="Next Month" class="nextCalArrow" alt="Next Month"
src="/s.gif" />
</apex:commandLink></td>
</tr>

<tr>
<th scope="col" class="calDays">SUN</th>
<th scope="col" class="calDays">MON</th>
<th scope="col" class="calDays">TUE</th>
<th scope="col" class="calDays">WED</th>
<th scope="col" class="calDays">THU</th>
<th scope="col" class="calDays">FRI</th>
<th scope="col" class="calDays">SAT</th>
</tr>

<apex:repeat value="{!weeks}" var="wk" id="foreachWeek">
<tr class="days">
<!-- or highlight -->
<apex:repeat value="{!wk.days}" var="day" id="foreachday">
<td valign="top"><a class="{!day.CSSName}"
href="{!day.href}" target="_blank"
title="{!day.title}">{!day.displayValue}</a></td>
</apex:repeat>
</tr>
</apex:repeat>

</tbody>
</table>
</div>
<div class="bottomLeft"><div class="bottomRight"/></div>
</div>

</apex:outputPanel>
</apex:form>

 

any help is greatly appreciated....

 

 

 

hey folks i basically want to do this

 

select Email, FirstName, LastName, Id from Contact where (email address exists more than once in the contact table) order by Email

 

any ideas? 

hi again, 

 

i'm in the very beginning stages of trying to get the activity history from a related object to display in a visual force page - very new to this as i'm sure you'll be able to tell...

 

i have this controller......

 

public class ContactController {

List<Contact> contact;

public List<Contact> getContact() {

if (contact == null) {
contact = [SELECT Id, Name, Email FROM Contact where Id =: '0035000000Zm8Zq'];
}
return contact;
}
}

 

and this vf page that calls it...

 

<apex:page controller="ContactController">

 

<apex:relatedList list="ActivityHistory" ></apex:relatedList>
</apex:page>

 

it displays nothing. i'm wondering if i'm even going about this in the right way? my assumption is that if i return the contact from the controller, i should be able to use the apex related list to display the activity history. 

 

any help/direction is greatly appreciated. 

 

apologies for multiple consecutive posts, but these are issues that have been driving me batty for too long. 

 

so i have a profile that i have used record types to limit the visibility of picklist options. the profile is owner/manager. it works great. the problem is, that i have many owners and managers and their dashboard as it pertains to profiles are pretty much identical expect for which picklist values they should see. i'm wondering/hoping that there is a way to show differnt picklist values to different users without having to create a different profile for each owner/manager who should be seeing something slightly different?

 

anyone come across this issue before? what was your solution?

 

thanks

 

dustin

hello,

 

is there anyway to pass variables to a home page component from data on the usr record? or from a url? i'm have an iframe on a home page component that displays an s control that displays a calendar for a certain group, and based on which group it needs a different id in the url for the iframe to render the proper data. 

 

thank you.

 

dustin

hi folks,

 

i have a custom object, booking__c that has a lookup to contact. i want a related list on booking__c that shows the activity history for the contact. is that possible?

 

thanks

 

dustin

hello again folks.

 

i have a custom object A, with a master detail relationship to custom object B (A master, B Detail). I have another custom object C that has a lookup field to custom object B. 

 

i have added the related list for custom object B to the layout page for custom object C. However, when i associate B to C via the lookup field on object C (mapped to B), it does not show up in the related list on the details page for C.

 

any thought are much appreciated.

 

thanks

 

dustin 

Hi folks, 

 

I have a custom object with a field called source that has a list of 20 master values associated with it. i have created a record type for profile group A. it works just as advertised and restricts the list of values that i assigned when creating a new record. However, for records that existed prior to the creation of the the record types, the list of values in the picklist still contain all of the values from the master list. is there a way to update/assign/unassign the picklist values for the older records?

 

thanks

 

dustin

hi folks this is my first attempt at writing a trigger - not going well! here's what i'm trying to do....

 

i have a custom object called Booking__c that has a lookup field called Commission_Agent__c. 

 

Booking__c is related via lookup to another custom object called Property__c.

 

Property__c has a lookup to a Contact record called Contact_Commission_Agent__c.

 

When a new Booking is created (not every time it's edited, just on creation - or directly after it's created i'm assuming), i need the trigger to lookup the Property__c record via the lookup Field Property__c on Booking__c - then update the Commission_Agent__c field with the id of the Contact_Commission_Agent__c field on the property object. 

 

here's what i have so far. 

 

trigger AssignCommAgent on Booking__c (after insert, before update)
{
//instantiate set to hold unique deployment record ids
Set<Id> bookingIds = new Set<Id>();
for(Booking__c s : Trigger.new)
{
bookingIds.add(s.Property__c);
}

//instantiate map to hold deployment record ids to their corresponding ownerids
Map<Id, Property__c> propertyCommAgentMap = new Map<Id, Property__c>([SELECT Id, Contact_Commission_Agent__c FROM Property__c WHERE Id IN: bookingIds]);

for (Booking__c s : Trigger.new)
{
if (s.Commission_Agent__c == null && propertyCommAgentMap.containsKey(s.Property__c))
{
s.Commission_Agent__c = propertyCommAgentMap.get(s.Property__c).Contact_Commission_Agent__c;
}
}
}

 

here's my error. 

 

Error:Apex trigger AssignCommAgent caused an unexpected exception, contact your administrator: AssignCommAgent: execution of BeforeUpdate caused by: System.NullPointerException: Attempt to de-reference a null object: Trigger.AssignCommAgent: line 17, column 1

 

any insights are greatly appreciated!

Hi folks i have this code that's supposed to be generating some data to be passed to visual force charts. i get this error....

 

Error: Compile Error: Constructor not defined: [PropertyInquiryReports.InqsClass].<Constructor>(Integer, Integer) at line 51 column 29

 

any insights? thanks you. 

 

 

public class PropertyInquiryReports {

 

    public List<AggregateResult> inqs = new List<AggregateResult>();

    

    public PropertyInquiryReports()

    {

 

        String Property_Name = Apexpages.CurrentPage().getParameters().get('Property_Name');

        String dfm = Apexpages.CurrentPage().getParameters().get('dfm');

        String dfy = Apexpages.CurrentPage().getParameters().get('dfy');

        String dtm = Apexpages.CurrentPage().getParameters().get('dtm');

        String dty = Apexpages.CurrentPage().getParameters().get('dty');

        

        Integer dfmC = integer.valueof(dfm);

        Integer dfyC = integer.valueof(dfy);

        Integer dtmC = integer.valueof(dtm);

        Integer dtyC = integer.valueof(dty);

 

        

        Date FromDate = date.newinstance(dfyC, dfmC, 1);

        Date ToDate = date.newinstance(dtyC, dtmC, 31);

 

        AggregateResult[] inqs = 

          

        [SELECT 

         COUNT(Id) theCount, 

         SUM(Reporting_Is_Converted_to_Booking__c) theCountConvertedBooking,

         CALENDAR_YEAR(CreatedDate) theYear,

         CALENDAR_MONTH(CreatedDate) theMonth

                             

         FROM Inquiry__c 

         WHERE Property__r.Name = :Property_Name AND 

         CreatedDate  >: FromDate AND CreatedDate <: ToDate 

            

         GROUP BY CALENDAR_Year(CreatedDate) , CALENDAR_MONTH(CreatedDate)

         ORDER BY  CALENDAR_Year(CreatedDate), CALENDAR_MONTH(CreatedDate) ASC ];

 

    }

 

    public list<InqsClass> getResults()

    {

 

        list<InqsClass> InqsCounts = new list<InqsClass>();

        

            for (AggregateResult ar: inqs)

            { 

 

             Integer the_count = Integer.valueOf(ar.get('theCount'));

             Integer the_count_converted_booking = Integer.valueOf(ar.get('theCountConvertedBooking'));

             String the_month_and_year = Integer.valueOf(ar.get('theYear')) + '-' + Integer.valueOf(ar.get('theMonth));

             InqsCounts.add(new InqsClass(the_count, the_count_converted_booking, the_month_and_year));

            }

                                    

        return InqsCounts;

    }

    

    class InqsClass

    {

            public Integer the_count {get; set;}

            public Integer the_count_converted_booking {get; set;}

public String the_month_and_year {get; set;}

                    

        public InqsClass(AggregateResult ar)

        {

            the_count = (integer)ar.get('theCount');

            the_count_converted_booking = (integer)ar.get('theCountConvertedBooking');

            the_month_and_year = (string)ar.get('the_month_and_year');

        }

 

    }

}

Hi everyone I'm trying to return an aggregate result to pass to visualforce charts with this controller. i need to sum multiple datapoints with different where clauses from the same object.

 

this is the error i get...

 

Error: Compile Error: Didn't understand relationship 'Booking__c' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names. at line 7 column 13

 

Booking__c is the same object as the main query

 

any insights are greatly appreciated

 

public with sharing class BkgPerformance {
public List<AggregateResult> getData() {

 

// return

List<AggregateResult> working =

 

[SELECT COUNT(Id) theCount,
(select count(Id) from Booking__c where Booking_Stage__c = 'Pending') thePending,

(select count(Id) from Booking__c where Booking_Stage__c = '1st Payment'), theFirst,

(select count(Id) from Booking__c where Booking_Stage__c = '2nd Payment'), theSecond,

CALENDAR_YEAR(CreatedDate) theYear


FROM Booking__c

GROUP BY CALENDAR_YEAR(CreatedDate)
ORDER BY CALENDAR_YEAR(CreatedDate)];

 


return (working);

}


}

hi i'm pretty new to visualforce, i'm sure you'll be able to tell. i'm creating a visualforce email template and i need to pull in an apex page that pulls data from a custom object. the code from the apex page looks like this:

 

<apex:page standardController="Inquiry__c">
{!Inquiry__c.Name}
</apex:page>

 

that's being called into the visual force template with an apex include statement. 

 

i ge this error when trying to select the template when trying to send the actual email though:

 

error: Id value 00Y5000000HOTmg is not valid for the Inquiry__c standard controller
 
the relatedto field in the messaging block is as follows.
 
relatedToType="Inquiry__c"
 
it works when i'm not calling in the component and pulls data from the correct objects, but when  i call in the component that is trying to get at the same data, it throws the error. any ideas. thanks in advance!
 

Hi,

    I find a very wired question about code coverage. See the attached pic. Why the close braces not covered? The same question to the TestMethod?  It's not the browser problem, I have tried in different browsers, the results are the same.

    Can anyone help me? Thank you very much!