• Chad Ritchie
  • NEWBIE
  • 115 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 25
    Questions
  • 21
    Replies

I'm trying to embed a Visualforce Page onto my home page that allows users to select a report and filter it right there. 

When running I seem to be getting the following error:
caused by: System.NullPointerException: Attempt to de-reference a null object

Class.AnalyticsController.getSelectedFilters: line 69, column 1
Class.AnalyticsController.getChartFilter: line 64, column 1


Can anyone identify what's causing this issue? I notice this code was written for API Ver 29, while I'm on 48. 

Visualforce Page: 

<apex:page controller="AnalyticsController">
<style>
label {
    font-weight: bold;
}
#filters {
    overflow: hidden;
    width: 100%
}
#filterBox {
    float: left;
    align: center;
    padding: 5px 5px 5px 0px;
}
</style>
<apex:form >
    <apex:outputLabel value="Select Report"/> 
    <apex:selectList value="{!reportId}" multiselect="false" size="1">
        <apex:selectOptions value="{!availableReports}"/>
    </apex:selectList>
    <apex:commandButton action="{!getReportInfo}" value="Get Report Filters" reRender="report"/><br/>

    <apex:outputPanel id="report" layout="block">
        <apex:outputPanel rendered="{!reportId != null}">
            <div id="filters">
                <apex:repeat value="{!availableColumnFilters}" var="colFilter">
                    <div id="filterBox">
                        <apex:outputLabel >{!colFilter.label}</apex:outputLabel><br/>
                        <apex:selectList value="{!colFilter.operator}" size="1" multiselect="false" style="width: 100px;">
                            <apex:selectOption itemLabel="--None--" itemValue=""/>
                            <apex:selectOptions value="{!availableDataTypeFilterOperators[colFilter.dataType]}"/>
                        </apex:selectList>
                        <apex:inputText value="{!colFilter.value}"/>
                    </div>   
                </apex:repeat>
            </div>

            <apex:commandButton value="Get Chart with Filters" reRender="chart"/><br/>

            <apex:outputPanel layout="block" id="chart">
                <analytics:reportChart reportId="{!reportId}" filter="{!chartFilter}"/>
            </apex:outputPanel>
        </apex:outputPanel>
    </apex:outputPanel>
</apex:form>
</apex:page>

Controller:
 
public with sharing class AnalyticsController{
 
    public List<SelectOption> availableReports { get; set; }
    public Id reportId { get; set; }
    public Map<String, List<SelectOption>> availableDataTypeFilterOperators { get; set; }
    public List<ColumnFilter> availableColumnFilters { get; set; }
 
    public AnalyticsController() {
        availableReports = retrieveAvailableReports();
        availableDataTypeFilterOperators = retrieveAvailableDataTypeFilterOperators();
    }
 
    public List<SelectOption> retrieveAvailableReports() {
        List<SelectOption> reptOpts = new List<SelectOption>();
        for (Report r : [
             Select Id, Name
             From Report
             Where Format In ('Summary','Matrix')
             Order By Name
        ]) {
            reptOpts.add(new SelectOption(r.Id, r.Name));
        }
        return reptOpts;
    }
 
    public Map<String, List<SelectOption>> retrieveAvailableDataTypeFilterOperators() {
        Map<String, List<SelectOption>> dataTypeFilterOpts = new Map<String, List<SelectOption>>();
        Map<String, List<Reports.FilterOperator>> filterOperatorMap = Reports.ReportManager.getDataTypeFilterOperatorMap();
 
        for (String dataType : filterOperatorMap.keySet()) {
            List<SelectOption> operators = new List<SelectOption>();
 
            // Append _DATA to match ColumnDataType from ReportTypeColumn
            dataTypeFilterOpts.put(dataType.toUpperCase() + '_DATA', operators);
 
            for (Reports.FilterOperator fo : filterOperatorMap.get(dataType)) {
                operators.add(new SelectOption(fo.getName(), fo.getLabel()));
            }
        }        
        return dataTypeFilterOpts;
    }
 
    public PageReference getReportInfo() {
        Reports.ReportDescribeResult descRes = Reports.ReportManager.describeReport(reportId);
 
        availableColumnFilters = new List<ColumnFilter>();
 
        for (Reports.ReportTypeColumnCategory category : descRes.getReportTypeMetadata().getCategories()) {
            for (Reports.ReportTypeColumn col : category.getColumns().values()) {
                if (col.getFilterable()) {
                    ColumnFilter cf = new ColumnFilter(
                        col.getLabel(),
                        col.getName(),
                        col.getDataType().name()
                    );
                    availableColumnFilters.add(cf);
                }
            }
        }
        return null;
    }
 
    public String getChartFilter() {
        return JSON.serialize(getSelectedFilters());
    }
 
    private List<ColumnFilter> getSelectedFilters() {
        List<ColumnFilter> selectedFilters = new List<ColumnFilter>();
        for (ColumnFilter cf : availableColumnFilters) {
            if (String.isNotBlank(cf.operator)) {
                selectedFilters.add(cf);
            }
        }
        return selectedFilters;
    }
 
    public class ColumnFilter {
        public ColumnFilter(String lab, String col, String dt) {
            label = lab;
            column = col;
            dataType = dt;
        }
 
        // Values needed for apex:analytics component
        public String column { get; set; }
        public String operator { get; set; }
        public String value { get; set; }
 
        // Values need for display and operator select list
        public String label { get; set; }
        public String dataType { get; set; }
 
    }
}

Thanks for the help!! 
Hey guys, 

Looking to write a test class for the following: 

trigger OpportunityAmountTrigger on Opportunity (Before Insert, Before Update) {
    for(Opportunity o : Trigger.New){
    if(trigger.isinsert && o.amount < 5000)
    o.addError('Amount can not be less than 5000');
    else if (Trigger.isUpdate && o.amount < 3000)
    o.adderror('Amount can not be updated to less than 3000');
 
    }
}

Here is what I have so far, but not sure where to go from here:

@isTest
public class OpportunityAmountTriggerTest {
    
    @isTest static void testOpportunity()
    {
        Integer Opportunity= Opportunity.amount(4000);
        System.assertEquals('Amount can not be less than 5000', Opportunity);
    }
}
Hey guys, I've attached my email template below. For the repeat part, how would I add a statement saying only repeat and list Opportunities that are 'Rejected'. ---- If(Opp.Status = 'rejected', than loop through them...... Not sure if this would go in the repeat statement or before it. Thanks!

<messaging:emailTemplate subject="Rejected Kits" recipientType="Contact" relatedToType="Contact">
<messaging:htmlEmailBody >
<html>
<style type="text/css">
body {font-family: calibri; size: 11pt;}
</style>
<body>
Dear {!relatedto.First_Name__c},
<br>
<br>
The following kit request(s) were rejected:
<br>
<br>
<apex:repeat var="OPP" value="{!relatedTo.Opportunities__r}">
<table border="1">
   <tr>
        <td>{!OPP.name}</td>   <td>{!OPP.OrderComments__c}</td>
   </tr>
</table>
</apex:repeat>
<br>
<br>
Let me know if there is anything I can do to help.
<br>
<br>
Regards, Chad
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</body>
</html>
</messaging:htmlEmailBody>
</messaging:emailTemplate>

Hey guys, I created a junction object, "CU", under a custom object, "Investor". The junction has a button to create a new record, which is just what we want, but how do we get that button to appear at the top of "Investor" record rather than way near the bottom as a Related Object button. Is this possible? It'd really help our users to see this New Record button at the top than at the bottom with other related object buttons.

Hey guys,

I'd like to have the following formula (which pulls in a heatmap of NY from the Documents Tab)
<apex:page standardcontroller="Contact" showHeader="false">
     <apex:image id="NY" value="{!'/servlet/servlet.FileDownload?file=0F01k00000002Wn'}" width="1920" height="940"/>
</apex:page>

use an if statement/merge field to verify that the record's state is actually NY. For example, I'd like in Excel terms to do if(contact.state__c = "NY", <apex:image id="NYJan19" value="{!'/servlet/servlet.FileDownload?file=0F01k00000002Wn'}" width="1920" height="940"/> ,"")

The reason being that I plan on having an image for every state so I need to merge in the record's state field so I can properly match them. Otherwise this would require 50 visualforce pages.

Thanks!!
Hey guys,

Here's what I have right now: MONTH( TODAY() ) + 1, 1) - 1) - 8),(IF( MONTH( TODAY() ) = 12,
DATE( YEAR( TODAY() ), 12, 31 ),
DATE( YEAR( TODAY() ), MONTH( TODAY() ) + 1, 1) - 1) - 7))

What would the formula look like if instead of just counting 7 days down from the last day of the month, and instead count down 7 business days from the last day of the month?

Thanks!!
Hey guys,

I would like to create a date formula that takes the last day of the current month and subtracts 7 business days from it. This part isn't too complicated to do with the Weekday function, but how would be the best way to deal with holidays. For example Christmas is right around the corner, so how could I tell this formula, without necessarily hardcoding it every year, to not ever count the 25th day of December? Here's kind of the foundation of my formula: (IF( MONTH( TODAY() ) = 12,
DATE( YEAR( TODAY() ), 12, 31 ),
DATE( YEAR( TODAY() ), MONTH( TODAY() ) + 1, 1) - 1) - 7
but I'm not sure where to start on the Holidays issue and I haven't had much luck using the Sobject Holidays..

Thanks!!!
Hey guys,

I have a few active workflows that look at an opportunity, if there's been no activity for 21 days, it'll send a follow up email to the Contact who owns the opportunity. In order have the email sent I have to login as another user, make a minor change on the opportunity to trigger it (usually I'll have a checkbox and do a list view so it's quick), and then the email will send from him. The problem is that everyday because there's hundreds of opportunities I have to go in there and trigger all of these opportunities as him in order for the emails to be sent. Is it possible to create a workflow/process/flow (preferrably not apex) that will automatically check each opportunities "Trigger box" as him, so then the emails automatically send as him without me ever having to go in, login as him, and manually check each opportunities "Trigger box" in a list view???

Thanks!!!
Hey guys,

Is it possible to attach a file, a PDF that appears under the "Files" related object, to an email??? Ideally if I'm using visualforce and the email is being triggering off of a change on the Opportunity object, I'd like to send an email and attach all the files that appear under the "Files" object on that opportunity. Is this possible, and if so how difficult would this be to achieve? Thanks!!
Hey guys, let's say contact is my primary object, but I then do a related lookup on Opportunity, which I have working, how would I do a lookup on a related object to Opportunity, let's call it Closings, can that be done? Here's my code: (The first bold part works, but the second doesn't)
THANKS!!
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
<messaging:emailTemplate subject="TEST" recipientType="Contact" relatedToType="Contact" >
<messaging:htmlEmailBody >
<html>
<style type="text/css">
body {font-family: arial; size: 12pt;}
</style>
<body>
Dear {!relatedTo.Name},

<br>
<br>
<apex:repeat var="opp" value="{!relatedTo.Opportunities__r}">
    <table border="0">
           <tr>
               <td>{!opp.Name}</td>
           </tr>
    </table>
</apex:repeat>


<apex:repeat var="cls" value="{!relatedTo.Opportunities__r.Closings__r}">
    <table border="0">
           <tr>
               <td>{!cls.Name}</td>
           </tr>
    </table>
</apex:repeat>

 
Hey guys,

So I'm new to creating Visualforce Email Templates. I'm really struggling to understand two things (and my code is below). First, where I mention Opportunity Requests below, what would the code look like to bring in a list from the opportunity object of all of their opportunities, but still have contact as the primary object. For example: Dear John Smith, here's a list of your opportunities: Opp1 Name, Opp2 Name, Opp3 Name.
So how would this work, since it's not as intuitive as merge fields, and second how would the code work so if someone has 20 Opps it looks good, and if someone has just 1 Opp it looks good, meaning not a ton of blank space. I know this is a lot to ask for, but I think if I can get down how to bring in cross-object info, similar to merge fields, and how to make info look good regardless of how many instances there are, than I'll be well on my way. THANKS so much!!!

<messaging:emailTemplate subject="Thanks for your Business" recipientType="Contact" relatedToType="Contact" >
<messaging:htmlEmailBody >
<html>
<style type="text/css">
body {font-family: arial; size: 12pt;}
</style>
<body>
Dear {!RelatedTo.Firstname},

<br>
<br>
Thank you for completing the following Opportunity Requests:

</br>
</br>
</body>
</html>
</messaging:htmlEmailBody>
</messaging:emailTemplate>
 
Hey guys,

This formula:

IF(AND(ISBLANK( Prospect_First_Name__c ),OR((ISPICKVAL(StageName,'Proposal Sent')),(ISPICKVAL(StageName,'Portfolio Analysis')),(ISPICKVAL(StageName,'Decision Stage')),(ISPICKVAL(StageName,'Account Implementation')))),"I wanted to follow-up and make sure you received and reviewed our proposal outlining how we might be able to provide your prospect with "+ Strategy_2__c +" solutions. Are there any other questions or concerns I can address? What are the next steps? I look forward to hearing from you,",IF(AND(NOT(ISBLANK( Prospect_First_Name__c )),OR((ISPICKVAL(StageName,'Proposal Sent')),(ISPICKVAL(StageName,'Portfolio Analysis')),(ISPICKVAL(StageName,'Decision Stage')),(ISPICKVAL(StageName,'Account Implementation')))),"I wanted to follow-up and make sure you received and reviewed our proposal outlining how we might be able to provide " + Prospect_Full_Name__c + " with "+ Strategy_2__c +" solutions. Are there any other questions or concerns I can address? What are the next steps? I look forward to hearing from you,",IF(OR(ISPICKVAL((StageName,'Open')),(ISPICKVAL(StageName,'OSG New'))),"I wanted to follow-up from our discussion to make sure I had addressed all your questions regarding available OSG solutions. Are there any concerns I can address? What are the next steps? I look forward to hearing from you,","")))   

is returning a Missing Parentheses error, and I'm not sure why, it seems like everything lines up. Thanks for the help!!
Hey guys,

I appreciate all the help I can get,

Here's my formula :

IF(ISBLANK(IF(Length_of_Strategy_String__c <50,(LEFT( Strategy_just_used_for_update_email__c , LEN( Strategy_just_used_for_update_email__c ) - 4)),IF(AND( Length_of_Strategy_String__c >50, Length_of_Strategy_String__c <56),(LEFT( Strategy_just_used_for_update_email__c , LEN( Strategy_just_used_for_update_email__c ) - 4)),IF( Length_of_Strategy_String__c >56,(LEFT( Strategy_just_used_for_update_email__c , LEN(Strategy_just_used_for_update_email__c ) - 4)))))),IF(Length_of_Strategy_String__c <50,(LEFT( Strategy_just_used_for_update_email__c , LEN( Strategy_just_used_for_update_email__c ) - 4)),IF(AND( Length_of_Strategy_String__c >50, Length_of_Strategy_String__c <56),(LEFT( Strategy_just_used_for_update_email__c , LEN( Strategy_just_used_for_update_email__c ) - 4)),IF( Length_of_Strategy_String__c >56,(LEFT( Strategy_just_used_for_update_email__c , LEN(Strategy_just_used_for_update_email__c ) - 4))))),GAI)

And here's the error:  Error: Incorrect number of parameters for function 'IF()'. Expected 3, received 2

I know it's very close, I just can't figure out where the error's coming from.

Thanks!

 
Hey guys,

How could I add some logic into this formula to remove the last "and" of every string. It's a multi-select-picklist. I know how to do this in a new formula using left(len()-4) and referring to the field, but how could this be done all in this same formula field? (trying to save some syntax size) Here's the formula:

IF(INCLUDES(Strategy__c, "A"), "A, and", NULL)+ IF(INCLUDES(Strategy__c, "B"), "B, and ", NULL)+ IF(INCLUDES(Strategy__c, "C"), "C, and", NULL) + IF(INCLUDES(Strategy__c, "D"), "D, and ", NULL) + IF(INCLUDES(Strategy__c, "E"), "E, and ", NULL) + IF(INCLUDES(Strategy__c, "F"), "F, and ", NULL) + IF(INCLUDES(Strategy__c, "G"), "G, and", NULL) + IF(INCLUDES(Strategy__c, "H"), "H, and" NULL) + IF(INCLUDES(Strategy__c, "I"), "I, and ", NULL) + IF(INCLUDES(Strategy__c, "J"), "J, and ", NULL) + IF(INCLUDES(Strategy__c, "K"), "K, and ", NULL) + IF(INCLUDES(Strategy__c, "L"), "L, and ", NULL) + IF(INCLUDES(Strategy__c, "M"), "M, and ", NULL) + IF(INCLUDES(Strategy__c, "N"), "N, and ", NULL) + IF(INCLUDES(Strategy__c, "O"), "O, and ", NULL) + IF(INCLUDES(Strategy__c, "P"), "P, and ", NULL)

Thanks!!
Hey guys,

I'm trying to figure out how to get this formula to work on just the first ",and" and not the second. Here's what I have: Chad, and Chris, and Sean.
I would like it to return Chad, Chris, and Sean by simply replacing ", and" with ",". And keep in mind that sometimes it brings back 1 name, sometimes 2, and sometimes 3, so I'd like to apply for each of those. Here's what I have now: SUBSTITUTE(LEFT(test__c, 40),", and",",")  but unfortuntely this always does it to both instances so it will return Chad, Chris, Sean, instead of adding an and after Chris. Any help is appreciated!!! I know this is really easy in excel because you can indicate the instance that you want it to apply to, but not sure about doing this on Salesforce. Thanks guys!!

Hey guys,

What's the syntax to use for a picklist value in order to have that value merge into a formula? So that way I see the value of the field, and not just the field's name. Thanks!!

Hey guys,

So I'm trying to create a field where if record is "A" than the field will be a calculation (Total/Estimate), therefore it's a percent field type. But, if the record is "B", meaning it doesn't have a total or an estimate, I'd like for the field to just show "N/A". Is there anyway this is possible to have text in a formula field of percent type. The reason being that I'd hate to have an error or blank field for all type "B"s. Thanks!!!
Hey guys,

I've created this formula, which will go in an email template and basically serve as the whole email. Unfortunately, the formula just keeps bringing back the field name, and not the value of the field. There's a small piece of my formula below, what I'd like is for the name of the Sales Professional to come in, but unfortunately every time I send myself an email, using this formula, the only thing that comes back is the name of the field, not the person. Any idea why this might be happening? (And I've tried to put the field in brackets, and a number of other formats, but still no luck. Thanks!!!

IF(AND(ISBLANK( Prospect_First_Name__c ),ISPICKVAL(StageName,'Proposal Sent')),"Dear SalesProfessional__r.Full_Name__c , I wanted to follow-up and make sure you received and reviewed our proposal.

Hey guys,

I'm creating a button on Salesforce that will automatically fill in many of the fields in an existing form that we use. But, I've run in to issues trying to autofill a question on the form which is in radio input type(3 different choices, looks like a multiple choice test, and only one can be picked). We need to prefill the top choice "option 1" as default, but we don't have the ability to actually change the form, so we have to figure out how, in a salesforce URL button, to have a default answer for this question. So far I have .................&BenchmarkKey=  input type=radio value="1"        But it is not working, if someone could help me figure out how to refer to a radio button in a salesforce URL Detail Page Button, that would be amazing! Thank you in advance!

Hey guys, I'm trying to figure out a formula that will only pull the first name of an email. So for example, pull "Chad" out of chad.c.ritchie@gggcorporation.com, but I also would need this to work for jonathan.n.reed@gggcorporation.com, so I imagine it is something to do with extracting values to the left of the furthest period, but I'm not sure how to do it. Here is what I have right now which isn't working:                      trim(left( Contact.Email ,find(".", Contact.Email ,1)-1))

Thank you!!

Pretty new to writing test classes, was looking for help for this trigger:

trigger SumPositions on Investor__c (before insert, before update, before delete) {
    for (Investor__c record : Trigger.new) {
        record.Sum_of_Positions__c = null;
    }
    for(AggregateResult result: [SELECT SEI_Investor_Id__c, SUM(Position__c.Balance__c)
                                 FROM Position__c WHERE SEI_Investor_Id__c
                                 IN :Trigger.newMap.keyset() GROUP BY SEI_Investor_Id__c]) {
         Trigger.newMap.get(result.get('SEI_Investor_Id__c')).Sum_of_Positions__c = (Decimal)result.get('expr0');
     }
 }
My organization requires a specific (and short) timeout for a particular case record type.  Only a subset of our users need access to these records so I have created dedicated profiles for the users who view this data.  

Now I need to prevent users who don't have this profile from being able to access the records.  I've done what I can with OWDs, profiles, sharing button (removed the button from the page layout for this record type), but now I'm trying to figure out how I can block access via the case team.

I have a case open with salesforce and the support rep recommended creating a VFpage for the record type.  I don't code so I'm trying to figure out what all of the options are before we try to bring on outside resources.  A validation rule isn't possible.  I could remove the case team related list from the page layout but I feel like someone might want to add a team member some day.  I did see the trailhead for 'with sharing' here (https://trailhead.salesforce.com/en/content/learn/modules/data-leak-prevention/identify-and-prevent-sharing-violations).  I don't really understand it but am trying to at least understand if it might be a possible solution.  Also I have had to create a trigger in the past to block users from deleting opportunity products.  I'm wondering if I could do the same for this.  Create a trigger that will block sharing for this record type with all users who don't have a particular word in their profile name.  

I'm really bummed that this is so complicated :/

Thanks in advance for your help!

 

I'm trying to embed a Visualforce Page onto my home page that allows users to select a report and filter it right there. 

When running I seem to be getting the following error:
caused by: System.NullPointerException: Attempt to de-reference a null object

Class.AnalyticsController.getSelectedFilters: line 69, column 1
Class.AnalyticsController.getChartFilter: line 64, column 1


Can anyone identify what's causing this issue? I notice this code was written for API Ver 29, while I'm on 48. 

Visualforce Page: 

<apex:page controller="AnalyticsController">
<style>
label {
    font-weight: bold;
}
#filters {
    overflow: hidden;
    width: 100%
}
#filterBox {
    float: left;
    align: center;
    padding: 5px 5px 5px 0px;
}
</style>
<apex:form >
    <apex:outputLabel value="Select Report"/> 
    <apex:selectList value="{!reportId}" multiselect="false" size="1">
        <apex:selectOptions value="{!availableReports}"/>
    </apex:selectList>
    <apex:commandButton action="{!getReportInfo}" value="Get Report Filters" reRender="report"/><br/>

    <apex:outputPanel id="report" layout="block">
        <apex:outputPanel rendered="{!reportId != null}">
            <div id="filters">
                <apex:repeat value="{!availableColumnFilters}" var="colFilter">
                    <div id="filterBox">
                        <apex:outputLabel >{!colFilter.label}</apex:outputLabel><br/>
                        <apex:selectList value="{!colFilter.operator}" size="1" multiselect="false" style="width: 100px;">
                            <apex:selectOption itemLabel="--None--" itemValue=""/>
                            <apex:selectOptions value="{!availableDataTypeFilterOperators[colFilter.dataType]}"/>
                        </apex:selectList>
                        <apex:inputText value="{!colFilter.value}"/>
                    </div>   
                </apex:repeat>
            </div>

            <apex:commandButton value="Get Chart with Filters" reRender="chart"/><br/>

            <apex:outputPanel layout="block" id="chart">
                <analytics:reportChart reportId="{!reportId}" filter="{!chartFilter}"/>
            </apex:outputPanel>
        </apex:outputPanel>
    </apex:outputPanel>
</apex:form>
</apex:page>

Controller:
 
public with sharing class AnalyticsController{
 
    public List<SelectOption> availableReports { get; set; }
    public Id reportId { get; set; }
    public Map<String, List<SelectOption>> availableDataTypeFilterOperators { get; set; }
    public List<ColumnFilter> availableColumnFilters { get; set; }
 
    public AnalyticsController() {
        availableReports = retrieveAvailableReports();
        availableDataTypeFilterOperators = retrieveAvailableDataTypeFilterOperators();
    }
 
    public List<SelectOption> retrieveAvailableReports() {
        List<SelectOption> reptOpts = new List<SelectOption>();
        for (Report r : [
             Select Id, Name
             From Report
             Where Format In ('Summary','Matrix')
             Order By Name
        ]) {
            reptOpts.add(new SelectOption(r.Id, r.Name));
        }
        return reptOpts;
    }
 
    public Map<String, List<SelectOption>> retrieveAvailableDataTypeFilterOperators() {
        Map<String, List<SelectOption>> dataTypeFilterOpts = new Map<String, List<SelectOption>>();
        Map<String, List<Reports.FilterOperator>> filterOperatorMap = Reports.ReportManager.getDataTypeFilterOperatorMap();
 
        for (String dataType : filterOperatorMap.keySet()) {
            List<SelectOption> operators = new List<SelectOption>();
 
            // Append _DATA to match ColumnDataType from ReportTypeColumn
            dataTypeFilterOpts.put(dataType.toUpperCase() + '_DATA', operators);
 
            for (Reports.FilterOperator fo : filterOperatorMap.get(dataType)) {
                operators.add(new SelectOption(fo.getName(), fo.getLabel()));
            }
        }        
        return dataTypeFilterOpts;
    }
 
    public PageReference getReportInfo() {
        Reports.ReportDescribeResult descRes = Reports.ReportManager.describeReport(reportId);
 
        availableColumnFilters = new List<ColumnFilter>();
 
        for (Reports.ReportTypeColumnCategory category : descRes.getReportTypeMetadata().getCategories()) {
            for (Reports.ReportTypeColumn col : category.getColumns().values()) {
                if (col.getFilterable()) {
                    ColumnFilter cf = new ColumnFilter(
                        col.getLabel(),
                        col.getName(),
                        col.getDataType().name()
                    );
                    availableColumnFilters.add(cf);
                }
            }
        }
        return null;
    }
 
    public String getChartFilter() {
        return JSON.serialize(getSelectedFilters());
    }
 
    private List<ColumnFilter> getSelectedFilters() {
        List<ColumnFilter> selectedFilters = new List<ColumnFilter>();
        for (ColumnFilter cf : availableColumnFilters) {
            if (String.isNotBlank(cf.operator)) {
                selectedFilters.add(cf);
            }
        }
        return selectedFilters;
    }
 
    public class ColumnFilter {
        public ColumnFilter(String lab, String col, String dt) {
            label = lab;
            column = col;
            dataType = dt;
        }
 
        // Values needed for apex:analytics component
        public String column { get; set; }
        public String operator { get; set; }
        public String value { get; set; }
 
        // Values need for display and operator select list
        public String label { get; set; }
        public String dataType { get; set; }
 
    }
}

Thanks for the help!! 

Hey guys, I created a junction object, "CU", under a custom object, "Investor". The junction has a button to create a new record, which is just what we want, but how do we get that button to appear at the top of "Investor" record rather than way near the bottom as a Related Object button. Is this possible? It'd really help our users to see this New Record button at the top than at the bottom with other related object buttons.

Hey guys,

I would like to create a date formula that takes the last day of the current month and subtracts 7 business days from it. This part isn't too complicated to do with the Weekday function, but how would be the best way to deal with holidays. For example Christmas is right around the corner, so how could I tell this formula, without necessarily hardcoding it every year, to not ever count the 25th day of December? Here's kind of the foundation of my formula: (IF( MONTH( TODAY() ) = 12,
DATE( YEAR( TODAY() ), 12, 31 ),
DATE( YEAR( TODAY() ), MONTH( TODAY() ) + 1, 1) - 1) - 7
but I'm not sure where to start on the Holidays issue and I haven't had much luck using the Sobject Holidays..

Thanks!!!
Hey guys,

I have a few active workflows that look at an opportunity, if there's been no activity for 21 days, it'll send a follow up email to the Contact who owns the opportunity. In order have the email sent I have to login as another user, make a minor change on the opportunity to trigger it (usually I'll have a checkbox and do a list view so it's quick), and then the email will send from him. The problem is that everyday because there's hundreds of opportunities I have to go in there and trigger all of these opportunities as him in order for the emails to be sent. Is it possible to create a workflow/process/flow (preferrably not apex) that will automatically check each opportunities "Trigger box" as him, so then the emails automatically send as him without me ever having to go in, login as him, and manually check each opportunities "Trigger box" in a list view???

Thanks!!!
Hey guys,

Is it possible to attach a file, a PDF that appears under the "Files" related object, to an email??? Ideally if I'm using visualforce and the email is being triggering off of a change on the Opportunity object, I'd like to send an email and attach all the files that appear under the "Files" object on that opportunity. Is this possible, and if so how difficult would this be to achieve? Thanks!!
Hey guys, let's say contact is my primary object, but I then do a related lookup on Opportunity, which I have working, how would I do a lookup on a related object to Opportunity, let's call it Closings, can that be done? Here's my code: (The first bold part works, but the second doesn't)
THANKS!!
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
<messaging:emailTemplate subject="TEST" recipientType="Contact" relatedToType="Contact" >
<messaging:htmlEmailBody >
<html>
<style type="text/css">
body {font-family: arial; size: 12pt;}
</style>
<body>
Dear {!relatedTo.Name},

<br>
<br>
<apex:repeat var="opp" value="{!relatedTo.Opportunities__r}">
    <table border="0">
           <tr>
               <td>{!opp.Name}</td>
           </tr>
    </table>
</apex:repeat>


<apex:repeat var="cls" value="{!relatedTo.Opportunities__r.Closings__r}">
    <table border="0">
           <tr>
               <td>{!cls.Name}</td>
           </tr>
    </table>
</apex:repeat>

 
Hey guys,

I appreciate all the help I can get,

Here's my formula :

IF(ISBLANK(IF(Length_of_Strategy_String__c <50,(LEFT( Strategy_just_used_for_update_email__c , LEN( Strategy_just_used_for_update_email__c ) - 4)),IF(AND( Length_of_Strategy_String__c >50, Length_of_Strategy_String__c <56),(LEFT( Strategy_just_used_for_update_email__c , LEN( Strategy_just_used_for_update_email__c ) - 4)),IF( Length_of_Strategy_String__c >56,(LEFT( Strategy_just_used_for_update_email__c , LEN(Strategy_just_used_for_update_email__c ) - 4)))))),IF(Length_of_Strategy_String__c <50,(LEFT( Strategy_just_used_for_update_email__c , LEN( Strategy_just_used_for_update_email__c ) - 4)),IF(AND( Length_of_Strategy_String__c >50, Length_of_Strategy_String__c <56),(LEFT( Strategy_just_used_for_update_email__c , LEN( Strategy_just_used_for_update_email__c ) - 4)),IF( Length_of_Strategy_String__c >56,(LEFT( Strategy_just_used_for_update_email__c , LEN(Strategy_just_used_for_update_email__c ) - 4))))),GAI)

And here's the error:  Error: Incorrect number of parameters for function 'IF()'. Expected 3, received 2

I know it's very close, I just can't figure out where the error's coming from.

Thanks!

 
Hey guys,

I'm trying to figure out how to get this formula to work on just the first ",and" and not the second. Here's what I have: Chad, and Chris, and Sean.
I would like it to return Chad, Chris, and Sean by simply replacing ", and" with ",". And keep in mind that sometimes it brings back 1 name, sometimes 2, and sometimes 3, so I'd like to apply for each of those. Here's what I have now: SUBSTITUTE(LEFT(test__c, 40),", and",",")  but unfortuntely this always does it to both instances so it will return Chad, Chris, Sean, instead of adding an and after Chris. Any help is appreciated!!! I know this is really easy in excel because you can indicate the instance that you want it to apply to, but not sure about doing this on Salesforce. Thanks guys!!

Hey guys,

What's the syntax to use for a picklist value in order to have that value merge into a formula? So that way I see the value of the field, and not just the field's name. Thanks!!

Hey guys,

I've created this formula, which will go in an email template and basically serve as the whole email. Unfortunately, the formula just keeps bringing back the field name, and not the value of the field. There's a small piece of my formula below, what I'd like is for the name of the Sales Professional to come in, but unfortunately every time I send myself an email, using this formula, the only thing that comes back is the name of the field, not the person. Any idea why this might be happening? (And I've tried to put the field in brackets, and a number of other formats, but still no luck. Thanks!!!

IF(AND(ISBLANK( Prospect_First_Name__c ),ISPICKVAL(StageName,'Proposal Sent')),"Dear SalesProfessional__r.Full_Name__c , I wanted to follow-up and make sure you received and reviewed our proposal.
Pretty new to writing test classes, was looking for help for this trigger:

trigger SumPositions on Investor__c (before insert, before update, before delete) {
    for (Investor__c record : Trigger.new) {
        record.Sum_of_Positions__c = null;
    }
    for(AggregateResult result: [SELECT SEI_Investor_Id__c, SUM(Position__c.Balance__c)
                                 FROM Position__c WHERE SEI_Investor_Id__c
                                 IN :Trigger.newMap.keyset() GROUP BY SEI_Investor_Id__c]) {
         Trigger.newMap.get(result.get('SEI_Investor_Id__c')).Sum_of_Positions__c = (Decimal)result.get('expr0');
     }
 }