• Cory Cowgill
  • PRO
  • 2615 Points
  • Member since 2010
  • Director of Product Engineering
  • Fusion Risk Management


Badges

  • Chatter
    Feed
  • 88
    Best Answers
  • 1
    Likes Received
  • 3
    Likes Given
  • 18
    Questions
  • 537
    Replies
Dear fellows

I've come across to an error in one of my apex classes:

Error:Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, ClientInvoiceAfterUpdate: execution of AfterUpdate caused by: System.DmlException: Update failed. First exception on row 0 with id a0Tb000000E6kACEAZ; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, ClientInvoiceAfterUpdate: execution of AfterUpdate caused by: System.QueryException: Non-selective query against large object type (more than 100000 rows). Consider an indexed filter or contact salesforce.com about custom indexing. Even if a field is indexed a filter might still not be selective when: 1. The filter value includes null (for instance binding with a list that contains null) 2. Data skew exists whereby the number of matching rows is very large (for instance, filtering for a particular foreign key value that occurs many times) Class.AP516_SetTECHAmountDue.updateTechAmountDue: line 29, column 1 Trigger.ClientInvoiceAfterUpdate: line 189, column 1: [] Class.AP511_SetTechTotalAmountDue.updateAmtDueCurrency: line 149, column 1 Trigger.ClientInvoiceAfterUpdate: line 177, column 1: []

The query is really simple and, as sugested by salesforce, I've splitted the filters of the query to see if in any of them, the result is greater than 100k records. The object where this query is running against to, has more than 100k records as well but the filter when applied separately retrieves way less than 100k records.

Your help and guidance are really appreciated

Best Regards,

Roniel Navarro
I need to create a button that is on the Account Page that opens a related (custom object) record where the Account ID is the same as the related record. There is only suppose to be one related record for each account.   I'm stumped on how to do it.  Thanks
A Salesforce Organization that I'm involved in is going to be part of a server split.  Somewhere in this I have a controller that uses a hard coded field ID in order to prepopulate fields when visiting a link.  Am I correct in thinking this will be affected in the server split?

Is there a way to dynamically get the ID of the field so I don't have to hard code this in?
Hi,

We are consolidating(merging) 2 salesforce.com instances.
What are the key things to consider during this process?
Please advise!!

Thank you!!
my vfpage:
<apex:page controller="picklistclass">
    <apex:form >
        <apex:pageblock >
            <apex:commandButton value="Show" action="{!show}"/>
            <apex:pageblocksection >
                <apex:selectList value="{!selectedAccId}" multiselect="false" size="1">
                    <apex:selectOptions value="{!Accountnames}"></apex:selectOptions>
                </apex:selectList>
<apex:outputField value="{!acc.Name}"/>
<apex:outputField value="{!acc.AccountNumber}"/>
</apex:pageBlockSection>       
</apex:pageblock>
    </apex:form>
</apex:page>

controller:
public with sharing class picklistclass
{
Account account;
    public Account acc { get; set; }
public list<contact> con{get;set;}
    public PageReference show()
    {
list<Account> acc = [Select Name, AccountNumber From Account Where Id =: selectedAccId ];
    return null;      
    }  
   
     public String selectedAccId{ get; set; }
    public List<selectOption> options=new List<selectOption>();
    List<Account> lstnames=new List<Account>();
   
    public List<selectOption> getAccountnames()
    {
        for(Account obj:[select Id,name from Account])
        {
            options.add(new selectOption(obj.name,obj.name));
        }
        return options;
    }
   
}
Hi
As a newbie, I wonder if you could help me with this issue:
I'm trying to write a trigger that populates a number of fields on the contact object based on different picklist values in the same child object. I need a trigger as there are not enough roll-up summary fields.  There will be thousands in the counts of each value.
Here is what I am attempting to do:

SELECT Id, Picklist_value__c FROM ChildObject__c WHERE Picklist_Value__c ='value a'
Count the total of Child records put the COUNT number into a 'Count 'value a' Roll-up' field on the Contact Object.
SELECT Id, Picklist_value__c FROM ChildObject__c WHERE Picklist_Value__c ='value b'
Count the total of Child records put the COUNT number into a 'Count 'value b' Roll-up' field on the Contact Object.
SELECT Id, Picklist_value__c FROM ChildObject__c WHERE Picklist_Value__c ='value c'
Count the total of Child records put the COUNT number into a 'Count 'value c' Roll-up' field on the Contact Object.
SELECT Id, Picklist_value__c FROM ChildObject__c WHERE Picklist_Value__c ='value d'
Count the total of Child records put the COUNT number into a 'Count 'value d' Roll-up' field on the Contact Object.

Thanks in advance for any help

- Save error: Unable to perform save on all files: com.salesforce.ide.api.metadata.types.Metadata$JaxbAccessorF_fullName cannot be
cast to com.sun.xml.internal.bind.v2.runtime.reflect.Accessor

I use an ETL tool that dumps all cases, contacts, users in salesforce to a sql database. Presently what im doing is I have the job saved in my ETL tool with the query Select * from cases and every time I run the job I set the condition to delete the existing table and create new table so there wont be duplicates whenever I run the job. Now I was asked to create a job that runs every night. So I dont want to use the query select * from cases as it would take atleast 5 hours to complete the job.
 
So I was looking for a customised query which should be this way.
 
select * from cases where created or updated time >= last dump date
 
 
So that way my job just fetches the updated and the newly created cases every day sparing the rest. 
 
 
Can I get it in some salesforce proper SOQL syntax please... That way I can query it in the ETL tool instead of using select * from cases every time I try to dump..
  • September 03, 2013
  • Like
  • 0

Hi,

I wish to know how do ask trigger not to run if profile of logged in user is system admin. What code do i place there.

 

2nd question is

When batch apex job is scheduled, does it run as system administrator profile?

 

Thanks

 

I'd like to test SOSL to get familiar with what I can do with it but when I put a query in the developer console, it doesn't seem to pass the parsing rules. How do I test SOSL queries before I build them in my Apex code?

In standard SQL I used to create self joins to find duplicate entries where you would have a field like Name, that should be unique, but because there is a composite key, but one of the values is not correct. Doing this I could write an SQL query that would be something like:

 

SELECT T1.NAME, T1.FIELD_1, T2.NAME, T2.FIELD_1

FROM MYTABLE AS T1, MYDABLE AS T2

WHERE T1.NAME = T2.NAME AND T1.FIELD_1 <> T2.FIELD_2

 

How would I do this in SOQL?

Hi there,

We are using SOAP API to update the lead object. One of our customers have two custom fields under lead which is marked as "required" in his custom page layout. Those two fields do come with default value formulas. However, the formulas are not executed when the lead is created by salesforce Web-To-Lead, which seems expected according to this FAQ. In this case, our API update failed with "MISSING_REQUIRED_FIELD" even we do not intend to touch those fields at all. So is there a way to skip required fields during updating?

 

One observation is this customer installed the "salesforce for google adwords". I found the "LeadSource" is updated by "salesforce for google adwords" when the lead is created by "Web-To-Lead". This seems indicating there is a way to do that?

 

help appreciated!

 

thanks,

Jason

  • May 01, 2013
  • Like
  • 0

Hi, as everyone knows when to delete a custom field, salesforce check the referenced source, such as Visualforce page, Apex class.
For example, if you want to delete [custom__c] field in an object, a deleteredirect.jsp page will show a list  that [custom__c] field has been referenced by, so that you couldn't delete it.

My problem is, I want to get the Referenced by List of all the fields in my Schema, but to delete all the fields one by one Manually is not a good way.

So is there a good solution?
Any help would be much appreciated!

Hello - 

 

I've ran into a strange issue I haven't seen before when using a Javascript remote function to return the results of a query..

 

I have a method that returns the results of a query on the Opportunity object:

 

@RemoteAction
Public static AggregateResult[] myOppsQuery {
      List<AggregateResult> ar = [Select Calendar_Quarter(CloseDate)Quarter, Sum(Commissionable_Margin__c)Margin from Opportunity where CloseDate = THIS_YEAR AND isWon = TRUE Group By Calendar_quarter(CloseDate) Order by Calendar_quarter(CloseDate)];
      
      return ar;
}

 

 

When this method is invoked by the javascript remote function the results I am getting differ from the results of the query by itself. Copy/pasting the query from the method into SoqlXplorer returns the correct value, but the javascript remote function results are not the same.

 

Is there some sort of caching of a previous value going on here? I've cleared browser cache + tried different browsers but the issue persists. 

 

Thanks in advance for taking a look at this - any assistance is greatly appreciated.

  • April 02, 2013
  • Like
  • 0

Hi Everyone,

 

     I am Sfdc newbee can anyone tell me the difference between general database trigger and salesforce triggers ???

 

 

 Thanks in Advance ,

 Response is highly appreciated.

  • March 30, 2013
  • Like
  • 0

Hi All,

 

I am trying to create a Report from an Object but all the field of that object are not available to me.But this happened only in case on Some Objects.

 

Please kindly Help and Guide.

hi iam new for salesforce

now i want know why we need the test the trigger in test class?

 

 

we are testing triggers in UI mode

then y need to write the test class for triggers?

  • March 29, 2013
  • Like
  • 0

I'm new to SF and trying to write a basic custom case controller that adds an attachment to a case.
I've simplified my apex code below. I'm guessing I need to do 
a.OwnerId = UserInfo.getUserId();
to get the attachment to show up under the user's case list? I would like to see the attachment

when I view a new case under the contact.

I would like to delete an attachment I used for a test but I can't find it.


public class MyCaseController {
    
    public Case c { get; set; }
    public Attachment a { get; set; }
          
    public MyCaseController() {
        c = new Case();
        a = new Attachment();        
    }

public PageReference save() {
        try {
            INSERT c;
            if (a.BodyLength > 0)
            {
                a.ParentId = c.Id;
                INSERT a;
            }
            return new PageReference('/apex/Thanks');
        } catch (Exception e) {
            ApexPages.addMessages(e);
            return null;
        }
}



<apex:page controller="MyCaseController" sidebar="False" showHeader="False">
    <apex:form >
        <apex:pageMessages ></apex:pageMessages><br />
        <apex:commandButton action="{!save}" value="Submit"/><br /><br />
        Issue type:<br />
        <apex:inputfield value="{!c.type}" required="true"/><br />
        Issue priority:<br />
        <apex:inputField value="{!c.priority}"/><br />
        Subject:<br />
        <apex:inputField value="{!c.Subject}" required="true"/><br />
        <apex:inputTextarea value="{!c.description}" rows="20" cols="20" /><br />
        Attachment:<br />
        <apex:inputFile value="{!a.body}" filename="{!a.name}" id="file"/>
    </apex:form>
</apex:page>

Hi,

 

I am creating tables in my salesforce's database through "Schema Builder", but I would like to do using SQL query, to accelerate the process.

 

Is this possible?

 

Thanks!

  • March 27, 2013
  • Like
  • 0

I have a page I am creating that will send some information to a seperate site.  The code to send the information to that site is written in asp.  Can I include asp on a visualforce page?

I am wondering what the roadmap is for the Salesforce Mobile SDK and updates to the Cordova framework for Hybrid applications. I want to use some cordova plugins but they require Cordova version 3.0 or higher. I have had this problem in the past where the Cordova version of the SFDC plugin was inhibiting some of the plugins I wanted to use.

I understand there will always be latency between a Cordova release and a SFDC plugin update. My question is what type of timetable will SFDC be pursuing.

Basically, when will I be able to use Cordova 3.0? :)

I have a curious case where I have a Visual Flow embedded in a Visualforce Page. This works fine.

 

I have a few variables in the Flow which are exposed to the Visualforce Page (For example, contact Name, Phone, and Email) which I want to display during the entire Flow process.This works fine except one problem:

 

The variables aren't displayed when they are set in the Flow. I have to go to an additional screen by clicking Next or Previous to get the values back in the Visualforce Page when they have already been set in the Flow.

 

Anyone seen this similar type behavior? It's probably something super simple but I just don't see it at the moment.

I have a Formula Field which is formatting some custom address data in a Text Formula Field.

 

This works fine in Salesforce via Browser. However, in Mobile it shows up with a <br> instead of a new line.

 

How can I get the Formula Field to render with line breaks properly in both Salesforce via Browser and Salesforce Mobile.

 

Thanks.

The source code for the breaksession for HTML5 Geolocation, Force.com, and 3rd Party Web Services can be found here:

 

https://github.com/corycowgill/sfbusradar

Wondering if anyone has used any GeoCoding services other than Google to use with Find Nearby?

 

Find Nearby is a great app, but one drawback is the 2500 limit you get from Google GeoCode service. If you have a lot of Accounts/Contacts this can become a multiweek effort to get everything encoded.

 

FindNearby stores a Mapping Status, Latitude, and Longitude Coordinate. Wondering if anyone has done anything with Batch Apex / Data Loader / ETC with another GeoCoding Service to get around this limitation.

 

Just curious! :)

I just passed the Advanced Developer 501 Certification Exam, now I'm waiting for the assignment stage and the essay stage.

 

Has anyone else passed the 501 exam in the last few months? How long did you have to wait for the second stage?

 

I've asked a few folks I know in the community and they are stillwaiting for the second stage and its been almost 1 year for one of them, 4 months for another guy......

 

Anyone have any idea? I sent a message to certification@salesforce.com, but I haven't gotten a response yet.....

Does anyone know if you can use the new Spring 11 Visualforce Inline Editing functionality to inline edit a dataTable or relatedList?

 

I.E. I want to display a set of records in a dataTable or relatedList, and edit those items directly in the list view. Similar to how inline editing works in list views.

 

Anyone know if this is possible with standard VF Inline Editing released in Spring 11?

This is just a general question.

 

I have a SF Org where some admins have already built out a bunch of custom objects, fields, etc (Just configuration, no code).

 

These folks now want to package up the base objects to create a 'Template' for doing custom installs into different orgs. As we all know, this is a common use case.

 

My problem? Well, they went down the path of creating all this configuraiton out without taking into account the issue of installing a package into an Org with existing Objects and Fields of the same name.

 

Are there any ways to resolve this issue without going into the configuration and changing every single object/field name to XXX_ObjectName? Just looking to see if there are any creative ways to get around this? I doubt it can be done, but thought I'd just throw this out there before I tell them to spend time renaming all their stuff.

 

 

I have the typical problem with styling a table in a visualforce page rendered as a PDF.

 

I am losing the border completely. I know the renderas="PDF" attribute in <apex:page> tag has some limitiations when it converts into PDF, especially Fonts losing some of their styling.

 

My question is this: has anyone found a way to get table styling working in PDF mode for a VF page?

 

Ideally, I should be able to modify my CSS below to work in the PDF mode. As usual, any suggestions are appreciated. Below is what I'm losing in the PDF.

 

    table.rankings {
        border-width: 1px;
        border-spacing: 0px;
        border-style: solid;
        border-color: black;
        border-collapse: collapse;
        background-color: white;
    }
    table.rankings th {
        border-width: 1px;
        padding: 3px;
        border-style: inset;
        border-color: gray;
        background-color: white;
        -moz-border-radius: 0px 0px 0px 0px;
    }
    table.rankings td {
        border-width: 1px;
        border-style: inset;
        border-color: gray;
        background-color: white;
        -moz-border-radius: 0px 0px 0px 0px;
    }

Does anyone have any experience calling .NET Web Service from Salesforce?

 

I have used the WSDL2Apex to generate my Apex Classes, however I am having troubling figuring out how to pass user login, password, and domain. The Web Service has examples for calling the WS from .NET, but it uses some System.Net.Credenitals class that is generated in Visual Studio and obviously we are on Apex Platform. Since this is a Web Service, this should be able to be called from any platform. I can't find an example on how to pass this type of information across to a .NET Web Service.

 

Specific Details: I am trying to invoke a Sharepoint Out-of-theBox WS from Apex Callout. I am contnually getting 401 Authorization Errors and can't figure out how to pass my usernmae/password/domain in the Sharepoint call.

Does anyone see the reason why this service can't be consumed by WSDL2Apex for generating my callout classes in Apex?

 

I am trying to make some SOAP WS calls to Sharepoint Server from Salesforce.

 


<wsdl:definitions xmlns:s0="urn:Microsoft.Search" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://microsoft.com/webservices/SharePoint/QueryService" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="http://microsoft.com/webservices/SharePoint/QueryService" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
  <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Microsoft Windows SharePoint Server 3.0 Search Query Web Service</wsdl:documentation>
  <wsdl:types>
    <s:schema elementFormDefault="qualified" targetNamespace="urn:Microsoft.Search">
      <s:element name="Query">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="queryXml" type="s:string" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="QueryResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="QueryResult" type="s:string" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="Registration">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="registrationXml" type="s:string" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="RegistrationResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="RegistrationResult" type="s:string" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="Status">
        <s:complexType />
      </s:element>
      <s:element name="StatusResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="StatusResult" type="s:string" />
          </s:sequence>
        </s:complexType>
      </s:element>
    </s:schema>
    <s:schema elementFormDefault="qualified" targetNamespace="http://microsoft.com/webservices/SharePoint/QueryService">
      <s:element name="QueryEx">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="queryXml" type="s:string" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="QueryExResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="QueryExResult">
              <s:complexType>
                <s:sequence>
                  <s:element ref="s:schema" />
                  <s:any />
                </s:sequence>
              </s:complexType>
            </s:element>
          </s:sequence>
        </s:complexType>
      </s:element>
    </s:schema>
  </wsdl:types>
  <wsdl:message name="QuerySoapIn">
    <wsdl:part name="parameters" element="s0:Query" />
  </wsdl:message>
  <wsdl:message name="QuerySoapOut">
    <wsdl:part name="parameters" element="s0:QueryResponse" />
  </wsdl:message>
  <wsdl:message name="QueryExSoapIn">
    <wsdl:part name="parameters" element="tns:QueryEx" />
  </wsdl:message>
  <wsdl:message name="QueryExSoapOut">
    <wsdl:part name="parameters" element="tns:QueryExResponse" />
  </wsdl:message>
  <wsdl:message name="RegistrationSoapIn">
    <wsdl:part name="parameters" element="s0:Registration" />
  </wsdl:message>
  <wsdl:message name="RegistrationSoapOut">
    <wsdl:part name="parameters" element="s0:RegistrationResponse" />
  </wsdl:message>
  <wsdl:message name="StatusSoapIn">
    <wsdl:part name="parameters" element="s0:Status" />
  </wsdl:message>
  <wsdl:message name="StatusSoapOut">
    <wsdl:part name="parameters" element="s0:StatusResponse" />
  </wsdl:message>
  <wsdl:portType name="QueryServiceSoap">
    <wsdl:operation name="Query">
      <wsdl:input message="tns:QuerySoapIn" />
      <wsdl:output message="tns:QuerySoapOut" />
    </wsdl:operation>
    <wsdl:operation name="QueryEx">
      <wsdl:input message="tns:QueryExSoapIn" />
      <wsdl:output message="tns:QueryExSoapOut" />
    </wsdl:operation>
    <wsdl:operation name="Registration">
      <wsdl:input message="tns:RegistrationSoapIn" />
      <wsdl:output message="tns:RegistrationSoapOut" />
    </wsdl:operation>
    <wsdl:operation name="Status">
      <wsdl:input message="tns:StatusSoapIn" />
      <wsdl:output message="tns:StatusSoapOut" />
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="QueryServiceSoap" type="tns:QueryServiceSoap">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
    <wsdl:operation name="Query">
      <soap:operation soapAction="urn:Microsoft.Search/Query" style="document" />
      <wsdl:input>
        <soap:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="QueryEx">
      <soap:operation soapAction="http://microsoft.com/webservices/SharePoint/QueryService/QueryEx" style="document" />
      <wsdl:input>
        <soap:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="Registration">
      <soap:operation soapAction="urn:Microsoft.Search/Registration" style="document" />
      <wsdl:input>
        <soap:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="Status">
      <soap:operation soapAction="urn:Microsoft.Search/Status" style="document" />
      <wsdl:input>
        <soap:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="QueryService">
    <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Microsoft Windows SharePoint Server 3.0 Search Query Web Service</wsdl:documentation>
    <wsdl:port name="QueryServiceSoap" binding="tns:QueryServiceSoap">
      <soap:address location="https://XXXX.YYYYYYYYYYYY.com/_vti_bin/spsearch.asmx" />
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

Anyone ever notice that if you change your VF Page, and then look at the VF Page in your browser inside your org via URL/apex/pageName the changes show up, but it sometimes takes a few minutes to show up on your force.com site?

 

<Seinfeld voice>What's the deal with VF Page refreshes in Sites? Is it updated or what?</voice>

 

But seroiusly, anyone notice this when debugging sites and have any tips on this? Other than trying to clear your history.......

Does anybody know if you can generate the text body of a MailTemplate inside Apex without sending an email?

 

For example, I want to genereate the body text of a MailTemplate for a preview screen before sending the email.

 

Another example, f you are creating a custom email page, and you want to mimic the functionality of the Activity Send Email page.

 

The standard email send page will generate the body text and put it on the page. Wondering if anyone has done similar for a custom VF page?

I have a controller extension for a list view.

 

The user selects a subset of the items in the list and clicks a button that goes to my custom VF Page.

 

I want to retain the order they were selected in the list from top to bottom. So if Selected Item A is before Selected Item B when the button is clicked, that is the order I WANT them passed to the controller.

 

However, the method getSelected() on the StandardSetController does not return the items in a sorted list the same as the screen.

 

Does anyone know how to keep the selected items sorted from the previous pages list view?

I have a nightly batch process which is going to do some updates to the Event objects. The job is scheduled to run from a System Administrator User who has MODFIY ALL for the profile.

 

I see this error popup once in a while when someone has marked an event as private.

 

First error: Update failed. First exception on row 31 with id XXXXXXXXXXXX ; first error: FIELD_INTEGRITY_EXCEPTION, Private events/meetings for other users are not allowed: Private: [IsPrivate]

 

Does anyone know how to get around this issue other than ignoring those records with isPrivate == true.

I know this may be impossible due to XSS, but I'm curious if anyone has found a creative way around this type of issue.

 

 I have a requirement from the user. They want to be able to display some rather complicated reports on the dashboard.

 

The report cannot be used as a dataset to any of the standard Dashboard components due to complexity/limits (too many columns, etc). I know this goes against the true purpose of a Dashboard in that its not intended to be a full blown detail view, but user is insistent on this.

 

So I spent  5 minutes building a quick Visualforce Page, sticking a quick IFrame tag inside pointing to the report, and tried whipping up some quick and dirty JS to remove the header section from the Report Page. Obviously this won't work due to XSS and will throw an 'Access is Denied' error on the JS.

 

Has anyone come up with a solution to view report content only in a Visualforce Page? I tried the above approach, as well as passing some URL Parameters to the report page but so far not quite what I want. Ideally I need  a way to display the printable view of the report or just the report content DIV section in a VF Page.

 

Any ideas, feedback, or crazy off the wall suggestions are appreciated. Just need to make sure I get the due diligence done here.

 

------ VF PAGE CODE WHICH WILL NEVER WORK DUE TO XSS -----------

<apex:page sidebar="false" showHeader="false"> <iframe id="iFrame123XYZ" src="/XXXREPORTIDXXX"> </iframe> <script> function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = func; } else { window.onload = function() { if (oldonload) { oldonload(); } func(); } } } addLoadEvent(btnHideHeader); function btnHideHeader() { window.setTimeout(hdrHide,100); } function hdrHide() { window.frames[0].document.getElementById('AppBodyHeader').style.display="none"; } </script> </apex:page>

 

 

I have an apex trigger on the Event object. The trigger works fine for both single and bulk DML operations on events.

 

I have a seperate apex test class using the @isTest annotation. I have two seperate test methods in the test class.

 

If I only run one of the test methods (I.E. I comment out the other test method) the unit test passes, the asserts are successful on either one of the test methods.

 

If I try to keep BOTH test methods in the same test class it fails. It may be end of long day and my eyes / memory is burnt out. But I am pretty sure you can have multiple "static testMethod void" tests run in a single Unit Test Class and that they should be independent of each other.

 

Any Ideas?

 

===================

@isTest
private class EventTriggerTest
{
    //Works If I comment out the second method, and vice-versa
    static testMethod void testAddWBAccountEventBulk()
    {
        test.startTest();
        Account firm = UnitTestFactory.buildTestFirm();
        insert firm;
        
        WB_Strategy__c strat = UnitTestFactory.buildTestWBStrategy();
        insert strat;
        
        WB_Account__c wbAcct1 = UnitTestFactory.buildTestWBAccount(firm.Id);
        wbAcct1.Strategy__c = strat.Id;
        insert wbAcct1;
        
        Contact aContact = UnitTestFactory.buildTestContact(firm.Id);
        insert aContact;
        List<Event> eventsInsert = new List<Event>();
        for(integer x = 0; x < 200; x++)
        {
            Event aEvent = UnitTestFactory.buildTestEvent(wbAcct1.Id, aContact.Id);
            aEvent.Strategy__c = null;
            eventsInsert.add(aEvent);
        }
        
        insert eventsInsert;
        
        List<Event> returnEvents = [Select Id, Strategy__c from Event where WhatId =: wbAcct1.Id];
        test.stopTest();
        system.assertEquals(200,returnEvents.size());
        for(Integer x = 0; x < 200; x++)
        {
            system.assertEquals(strat.Name,returnEvents.get(x).Strategy__c);
        }
    }    
    
    static testMethod void testAddWBAccountEvent()
    {
        test.startTest();
        Account firm = UnitTestFactory.buildTestFirm();
        insert firm;
        
        WB_Strategy__c strat = UnitTestFactory.buildTestWBStrategy();
        insert strat;
        
        WB_Account__c wbAcct1 = UnitTestFactory.buildTestWBAccount(firm.Id);
        wbAcct1.Strategy__c = strat.Id;
        insert wbAcct1;
        
        Contact aContact = UnitTestFactory.buildTestContact(firm.Id);
        insert aContact;
        
        Event aEvent = UnitTestFactory.buildTestEvent(wbAcct1.Id, aContact.Id);
        aEvent.Strategy__c = null;
        insert aEvent;
        
        Event returnEvent = [Select Id, Strategy__c from Event where Id =: aEvent.Id limit 1];
        test.stopTest();
        system.assertEquals(strat.Name,returnEvent.Strategy__c);
    }
}

In Winter 11, we can now have Attachments on Tasks. I have a trigger (after update, after insert, after delete, after undelete) on Attachment which will update a custom field on Task with the Attachment Count. This works fine when adding or deleting Attachments in my Unit Tests as well as through UI on the Attachment screen if I update the attachment.

 

My issue is that if a user is on the Task "Edit" page, there is the button to "Attach File" on the Attachment section which gives you the popup to attach multiple files. When the user adds Attachments via this page the Trigger isn't firing for Attachments. I don't see the Attachment trigger even firing in the debug logs. Very odd. Anyone have any suggestions or similar experience?  Alternative solutions are accepted also.

 

This isn't a typical Master-Detail Relationship so you can't do Roll-Up Summary fields.


Thanks.

In Winter 11, we can now have Attachments on Tasks. I have a trigger (after update, after insert, after delete, after undelete) on Attachment which will update a custom field on Task with the Attachment Count. This works fine when adding or deleting Attachments in my Unit Tests as well as through UI on the Attachment screen if I update the attachment.

 

My issue is that if a user is on the Task "Edit" page, there is the button to "Attach File" on the Attachment section which gives you the popup to attach multiple files. When the user adds Attachments via this page the Trigger isn't firing for Attachments. I don't see the Attachment trigger even firing in the debug logs. Very odd. Anyone have any suggestions or similar experience?  Alternative solutions are accepted also.

 

This isn't a typical Master-Detail Relationship so you can't do Roll-Up Summary fields.


Thanks.

Hi,

We are giving record access to users other than sys admin through apex trigger for Account object. But some records are shared to users even though there is no manual sharing, role hierarchy permission, no records which the user is owner, no permission sets and no View All permission at profile level. We even checked the Account Share object where no shared records found for the particular user. 

Could anyone please suggest what could be the problem.

Thanks
I create a form in visualforce page and create force.com website. At force.com submit button is showing but input filed not showing. please provide me solution
In Salesforce org there are more than 900+ classes. As a part of clean up project we need to remove unused classes.
1. what is the way to find out unused classes in the system ?
2. Is there any tool exist ?

Please mention your email id for future communication / Questions.

-- Thanks --
Hi All,
I am running test classes in my production Org, for some Classes it showing 0% Coverage for some classes it showing 97%.
The same test class tried run in my sandbox it showing code coverage for all classes.
Can any one tell me how to solve this Issue.
how to get records in vf page without using controllers(Either standard or custom) or class methods like properties...

can anyone help me out of this?

Thanks
system.debug([Select COUNT() from XXX__c]);

will raise:
FATAL_ERROR|System.LimitException: Too many query rows: 50001
Hey all!

I'm wondering why our Developer here at my company is getting this error when he's just typing in code into the console - nothing else.

An unexpected error has occured. 1890225493-1668894 (528326319) for deploymentID=1drK0000000KTj6IAC  If this persists, please contact customer support. 

Any help would be appreciated!  Thanks!
I want to add outlook contacts to Salesforce. Only from Outlook to Salesforce, after validation and excluding Gmail and Hotmail contacts. Only one way from Outlook to Salesforce addition is expected. No update, edit of existing contacts in Salesforce is required.
I am not a developer,so bear with me. Can someone tell me whether you can customize a validation rule using VF or Apex or whether you need to write a Trigger to do the comparison. I am trying to compare a summary from 2 different tables, then pop up a message saying " Your Actual is greater than budget"

Thanks
Rich Spitz
I have a two picklist values.
1.Country  2.State
if i select the india then the  state picklist shoud have states belongs to india.Like that Us also

Can Any one help me.If possible provide the code

Thanks 
HI,
how to create pop-up click on record in apex class?

When ever we are click on record. it will show the pop-up window and alsow in that pop-up window populate the all values? could you plas any one help me .


Thanks,
Viswa
Dear fellows

I've come across to an error in one of my apex classes:

Error:Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, ClientInvoiceAfterUpdate: execution of AfterUpdate caused by: System.DmlException: Update failed. First exception on row 0 with id a0Tb000000E6kACEAZ; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, ClientInvoiceAfterUpdate: execution of AfterUpdate caused by: System.QueryException: Non-selective query against large object type (more than 100000 rows). Consider an indexed filter or contact salesforce.com about custom indexing. Even if a field is indexed a filter might still not be selective when: 1. The filter value includes null (for instance binding with a list that contains null) 2. Data skew exists whereby the number of matching rows is very large (for instance, filtering for a particular foreign key value that occurs many times) Class.AP516_SetTECHAmountDue.updateTechAmountDue: line 29, column 1 Trigger.ClientInvoiceAfterUpdate: line 189, column 1: [] Class.AP511_SetTechTotalAmountDue.updateAmtDueCurrency: line 149, column 1 Trigger.ClientInvoiceAfterUpdate: line 177, column 1: []

The query is really simple and, as sugested by salesforce, I've splitted the filters of the query to see if in any of them, the result is greater than 100k records. The object where this query is running against to, has more than 100k records as well but the filter when applied separately retrieves way less than 100k records.

Your help and guidance are really appreciated

Best Regards,

Roniel Navarro
Hi everyone,,
We have VF pages with custom field labels that differ from the backend field labels. Trying to save the page with such a required field blank causes two error message to display: one using the custom label and the other the backend label. We have implemented VF pages in the same way in other orgs and do not have this issue. The VF page uses a controller which creates a map between the field API name and the label we want to show.  Because some of the custom labels are quite long, relabeling the backend fields is not an option. Any ideas are appreciated. Thanks!
I have to use a custom button to update a picklist. The field is 'Industry' in the 'Lead' tab. I have created the button and entered the java script below
{!REQUIRESCRIPT ("/soap/ajax/24.0/connection.js")}

var records = {!GETRECORDIDS($ObjectType.Lead)};
var newRecords = [];
if (records[0] == null) {
alert("Please select at least one lead")
}
else {
for (var n=0; n<records.length; n++) {
var c = new sforce.SObject("Lead");
c.id = records[n];
c.Industry =new Industry;
newRecords.push(c);
}
result = sforce.connection.update(newRecords);
window.location.reload();
}

but its showing the error like ' Industry is not defined '.

Can anyone help?

Hi,

I would like to know if we could customize Partner Portal login URL to some formal URL (like we have for login.salesforce.com) or is it fixed to the standard login URL?

"https://ap1.salesforce.com/secur/login_portal.jsp?orgId=ORG ID&portalId=PORTAL ID"

I need something of a simpler version like community.mydomain.com which apparently shows the users the login form and when logged in would show the normal Salesforce Home tab.

Regards
Sapthagiri

 I have setup an email service and have the follow class that when an email is sent it create a record in the custom object ticket but i want it to pull any attachments and save them in the attachment section for that record.  I do not geting errors but no attachments are being saved

global class EmailToTicket implements Messaging.InboundEmailHandler {

        global Messaging.InboundEmailResult handleInboundEmail(Messaging.InboundEmail email,
            Messaging.InboundEnvelope envelope) {
            
            Messaging.InboundEmailResult result = new Messaging.InboundEmailresult();
           
     
           
            Ticket__C sTicket = new Ticket__C();       
            {
            sTicket.Job__C = 'a013000000UHggN';
            sTicket.Subject__C = email.subject;
            sTicket.description__C= email.plainTextBody;
            sTicket.Web_Email__C=email.FromAddress;
            insert sticket;
           
         if (email.textAttachments != null)
            {
            for(Messaging.Inboundemail.TextAttachment tAttachment : email.textAttachments)
            {
            Attachment attachment = new Attachment();

            attachment.Name = tAttachment.fileName;
            attachment.Body = Blob.valueOf(tAttachment.body);
            attachment.ParentId = sTicket.Id;
            insert attachment;
            }
           
            }

            //Save any Binary Attachment
           
            if (email.binaryAttachments != null)
            {
            for(Messaging.Inboundemail.BinaryAttachment bAttachment : email.binaryAttachments) {
            Attachment attachment = new Attachment();

            attachment.Name = bAttachment.fileName;
            attachment.Body = bAttachment.body;
            attachment.ParentId = sTicket.Id;
            insert attachment;
            }
           }
        }

        result.success = true;
        return result;
            
   }
}

Today we’re excited to announce the new Salesforce Developers Discussion Forums. We’ve listened to your feedback on how we can improve the forums.  With Chatter Answers, built on the Salesforce1 Platform, we were able to implement an entirely new experience, integrated with the rest of the Salesforce Developers site.  By the way, it’s also mobile-friendly.

We’ve migrated all the existing data, including user accounts. You can use the same Salesforce account you’ve always used to login right away.  You’ll also have a great new user profile page that will highlight your community activity.  Kudos have been replaced by “liking” a post instead and you’ll now be able to filter solved vs unsolved posts.

This is, of course, only the beginning  and because it’s built on the Salesforce1 Platform, we’re going to be able to bring you more features faster than ever before.  Be sure to share any feedback, ideas, or questions you have on this forum post.

Hats off to our development team who has been working tirelessly over the past few months to bring this new experience to our community. And thanks to each of you for helping to build one of the most vibrant and collaborative developer communities ever.
 

As many of you have discovered, our developer community is awesome. The wealth of knowledge here is phenomenal. This is an all volunteer community and people who take the time to help and post answers do so totally on their own initiative. With that said when someone provides the right answer to your question please take the time to mark their answer as the accepted solution. Also give them a kudos if they've really gone the extra mile to help out. Show some love ;)