• Ron Hess
  • PRO
  • 4195 Points
  • Member since 2003

  • Chatter
    Feed
  • 108
    Best Answers
  • 6
    Likes Received
  • 0
    Likes Given
  • 20
    Questions
  • 2514
    Replies

I've been trying to use the Excel Connector for the last two weeks to manage the data in our organisation, but I'm having a problem where I get the following error in Excel which is preventing me from using this tool:

 

Error Generated by request::An internal server error has occured while processing your request.
Url:https://www.salesforce.com/services/Soap/c/13.0

ExceptionCode : 5103

The first couple of times I tried to use Excel Connector it worked fine. However I then started seeing this error every time I tried to use it - the error appears after I put in my password in Excel Connector and click Login.

 

We are on Salesforce Professional. I have tried uninstalling and reinstalling the toolkit and connector, but it hasn't made a difference. I'm using Excel 2010 32-bit on Windows 7 64-bit.

 

I can log in to Salesforce in my browser on the same computer.

 

I've checked that IE is not in Offline Mode, and verified that Excel can actually connect to the internet (pinged a URL using VBA script).

 

I've tried disabling my antivirus (MSE) and windows firewall.

 

I've tried changing the server url as suggested by this thread (had to modify registry keys to do this as that field was not editable in the connector.

 

None of these resolutions worked.

 

Has anyone experienced and managed to resolve this, or can anyone suggest any other possible resolutions?

Hi, 

 

I would want to get the quantity from the input text of the table. I need it so that I can update the quantity for quote_line_items object.

 

<apex:page standardController="Product2" extensions="ProductListController">
<apex:form >
    <apex:pageBlock title="Products List">
        <apex:pageBlockSection title="List of Available Address" columns="1">
            <apex:pageBlockTable value="{!productsList}" var="prod"> 
                
                <apex:column headerValue="Select"> 
	    	 		<apex:commandLink value="Select" onclick="return confirm('Are you sure?')" action="{!selectId}" >
		          		<apex:param name="prodid" value="{!prod.id}" />
		          	</apex:commandLink>
		        </apex:column> 
                </apex:column>
                <apex:column headerValue="Product Name" >{!prod.Name}</apex:column>
                <apex:column headerValue="Size/Dimensions" >{!prod.Size_Dimensions__c}</apex:column>
                <apex:column headerValue="Total Quantity" >{!prod.Total_Quantity__c}</apex:column>
                <apex:column headerValue="Available Quantity" >{!prod.Available_quantity__c}</apex:column>
                <apex:column headerValue="Quantity Required" >
                    <apex:inputText value="{!quantity}"></apex:inputText>
                </apex:column>              
            </apex:pageBlockTable>
        </apex:pageBlockSection>    
    </apex:pageBlock>   
</apex:form>
</apex:page>

 

public with sharing class ProductListController{
    public Product2 product;
    public List<Product2> productsList = null;
    public id quoteId {get; set;}
    public String productId {get; set;}
    public Integer quantity;
    
    public ProductListController(ApexPages.StandardController controller)
    {
        product = (Product2) controller.getRecord();
        quoteId = ApexPages.currentPage().getParameters().get('quoteId');
    }
    
    public Integer getQuantity()
	{
	  return quantity;
	}
	
	public void setQuantity(Integer newTD)
	{
	   quantity=newTD;
	}
    
    public List<Product2> getProductsList()
    {   
        try{
            String query = 'SELECT ID, NAME, Available_quantity__c, Total_Quantity__c,  Size_Dimensions__c FROM Product2 ';
            productsList = Database.query(query);
        }
        catch(Exception e)
        {
            System.debug(e.getMessage());
        }   
        return productsList;
    }
    
    public PageReference selectId(){
    	productId = System.currentPageReference().getParameters().get('prodid');
    	Quote__c quote = [Select id,Name from Quote__c where id=:quoteId];
    	if(productId.length()>15){
			productId = (productId).substring(0,15);	
		}
    	Quote_Line_Item__c quoteLineItem = new Quote_Line_Item__c();    	
    	Product2 product = [Select id, Name from product2 where id=:productId];
    	quoteLineItem.Name = 'PROD - '+quote.Name+'  '+product.Name;
    	quoteLineItem.Product__c =  product.Id;
    	System.debug('*********Quantity*********' + quantity);
    	quoteLineItem.Quantity__c = quantity; 
    	quoteLineItem.Quote__c = quoteId;  	
    	insert quoteLineItem;
    	
    	return new PageReference('/' + quoteId);
    	 
    }
    
}

 But the quantity value does not pass into the variable. Can you please help me out.

 

 

My entire APEX trigger is wrapped in a try/catch block, catching the generic Exception object, but I'm still hitting a fatal System.LimitException.

 

What's the point of try/catch if it doesn't actually catch an exception? 

How can I make sure my try / catch block prevents a fatal error?

 

Here's the relevant snippet:

 

for (Contact c : [SELECT Email, Id FROM Contact WHERE AccountId = :account_id LIMIT 10]) {
  if(c.Email != null){
    try {
      Messaging.SingleEmailMessage message = new Messaging.SingleEmailMessage();
      message.setTemplateID(email_template.Id);
      message.setWhatId(detail.Id);
      message.setTargetObjectId(c.Id);
      Messaging.sendEmail(new Messaging.SingleEmailMessage[] { message });
    }    

    catch (System.LimitException e) {

      // I don't really care if the email fails.

      // I just don't want it to break my data entry process.

     }

     catch (Exception e) {

      // I don't really care if the email fails.

      // I just don't want it to break my data entry process.
    }
  }

}

 

updated: even explicitly catching system.limitexception fails.

I have a before trigger that calls this class which auto assigns the region and the ownerid to the account based on the recordtype, state and zip of the region object. the region object holds all the assignments. It works great but when I execute a batch load through data laoder I hit too many script statements 200001 error. any way i can fix?

 

 

public with sharing class AccountUtilities
{
public static void acctAssign(List<Account> aList)
{
List<region__c> rList = [select id, zip_start__c, zip_end__c, state__c,sales_user__c, business_unit__c, recordTypeId from region__c];
Map<Id,RecordType> rtMap = new Map<Id,RecordType>([Select id,Name from RecordType where sObjectType IN ('Account','region__c')]);
for(Account a:aList)
{
try
{
for(integer i= 0; i< rList.size(); i++)
{
String billingPostalCode= String.valueOf(a.BillingPostalCode);
if(a.billingstate== rList.get(i).state__c && a.Protected__c != true && rtMap.get(a.recordtypeid).Name == rtMap.get(rList.get(i).recordtypeid).Name && a.business_unit__c == tList.get(i).business_unit__c)
{
if(a.billingPostalCode >= rList.get(i).zip_start__c && a.billingPostalCode<=rList.get(i).zip_end__c || rList.get(i).zip_start__c ==null && rList.get(i).zip_end__c ==null )
{
a.region__c = rList.get(i).id;
a.OwnerId = rList.get(i).sales_user__c;
}
}
}
}
catch (System.Exception e)
{
// process exception
}

}
}



Are there any examples to creating a time-based trigger? I am needing to remove the value in a lookup field after 30 days field was populated.

Hi All

 

my dobut is

 

my trigger code coverage is 80% and my organization code coverage is 60 %..so can it possible to move this trigger in to production environmnet??

 

how  to calculates the codecoverages it takes as individual apexclass or overall organization code coverages

 

thanks in advance

thanks

neeru

We have a class that's listed like this in our org:

 

Version: 24.0

Status: Active

Size without Comments: 2076

Coverage: 14% (32/216)

 

This class is, in total, 38 lines, covered like this:

 

5 "white" lines, not counted.

10 "red" lines, not covered.

23 "blue" lines, covered.

 

How is it that the coverage could be this screwed up?

I've reported a bug to the partner portal, case 08197046

 

I'd like to understand if anyone else has reported this issue or worked around it.

 

we have a simple rule to identify duplicates on the Name field.

 

AND(OR(ISNEW(),ISCHANGED(Name)), VLOOKUP( $ObjectType.Supplier__c.Fields.Name , $ObjectType.Supplier__c.Fields.Name ,Name)<>NULL)

 

 

and a simple testmethod 

 

System.assertEquals( 0, [ select id from Supplier__c ].size() );
Supplier__c supplierObj = new Supplier__c();
supplierObj.Name= 'Test Supplier';    
insert supplierObj;

 

My API setting is 25.0, and the assert passes, since no data is visible to my test method.

 

now, i run my test method and it fails on the insert statement ( yes the database has a Test Supplier )

 

 

18:05:03.386 (5386958000)|SOQL_EXECUTE_BEGIN|[64]|Aggregations:0|select id from Supplier__c
18:05:03.388 (5388301000)|SOQL_EXECUTE_END|[64]|Rows:0
18:05:03.388 (5388663000)|DML_BEGIN|[67]|Op:Insert|Type:Supplier__c|Rows:1
18:05:03.400 (5400613000)|CODE_UNIT_STARTED|[EXTERNAL]|Validation:Supplier:new
18:05:03.400 (5400628000)|VALIDATION_RULE|03dE00000000EbW|Unique_Name
18:05:03.400 (5400914000)|VALIDATION_FORMULA|AND(OR(ISNEW(),ISCHANGED(Name)), VLOOKUP( $ObjectType.Supplier__c.Fields.Name  ,  $ObjectType.Supplier__c.Fields.Name ,Name)<>NULL)|Name=Test Supplier , $ObjectType.Supplier__c.Fields.Name=Supplier__c.Name
18:05:03.400 (5400929000)|VALIDATION_FAIL
18:05:03.404 (5404672000)|CODE_UNIT_FINISHED|Validation:Supplier:new
18:05:03.405 (5405933000)|DML_END|[67]
18:05:03.408 (5408566000)|VF_PAGE_MESSAGE|This Supplier already exists
18:05:03.408 (5408686000)|EXCEPTION_THROWN|[67]|System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, This Supplier already exists: [Name]
18:05:03.409 (5409633000)|FATAL_ERROR|System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, This Supplier already exists: [Name]

 

I can conclude that VLOOKUP() can see data even if called from a test method that cannot see data.

 

This makes validation rules look like a serious hazard when writing test methods, how could i know what data is already in the org ? How can i protect my test methods from data that exists ?

 

I turned off this validation rule, and sure enough the test method behaves as expected.

 

thanks for any ideas.

 

Hi,
Since the latest Winter release we have had trouble with one of our Visualforce pages that uses a custom Apex controller. The page displays a list of leads with the Most Recently Responded to Campaign Name and the Response Date.  See image below of what it used to look like (But with a Date in the Response Date column):

This image is not available because: You don’t have the privileges to see it, or it has been removed from the system

We are getting the following error on the page: 
     "Invalid CurrencyIsoCode for SObject CampaignMember"

If we hide the Campign Response Date column from the page, or use a different field then the page renders ok. It seems to only error when we are picking a field from the CampaignMember object.

Is someone able to help us?? I haven;t got a response from Salesforce yet and am rather perplexed about this error as we dont really use the Currency fields in our org, everything is in USD.
I have included the snippets of VS Page code and Apex Controller code that seem relevant.



------------- Start VisualForce Snippet -----------------
    <apex:pageBlockTable value="{!leads}" var="l" id="table">
        <apex:column >
            <apex:outputLink style="font-weight:bold" value="/{!l.Id}/e?retURL={!l.Id}"> Edit </apex:outputLink>                   
        </apex:column>
       
        <apex:column >
            <apex:facet name="header">Owner</apex:facet>
            <apex:outputLink value="/{!l.owner.Id}"> <apex:outputText value="{!l.owner.name}"/> </apex:outputLink>                   
        </apex:column>
        <apex:column >
            <apex:facet name="header">Rating</apex:facet>
            <apex:outputText value="{!l.rating}"/>           
        </apex:column>
        <apex:column >
            <apex:facet name="header">Status</apex:facet>
            <apex:outputText value="{!l.status}"/>                   
        </apex:column>
    
        <apex:column >       
            <apex:facet name="header">
            <!--     <apex:commandLink value="{!$ObjectType.Lead.Fields.Name.Label}" action="{!doSort}" rerender="theForm">
                    <apex:param name="sortField" value="Name" assignTo="{!sortField}"/>                           
                </apex:commandLink>  -->
                Name
            </apex:facet>
       
            <apex:outputLink value="/{!l.Id}"> <apex:outputText value="{!l.name}"/> </apex:outputLink>                   
        </apex:column>
                
        <apex:column width="200px" >
            <apex:facet name="header">Title</apex:facet>
            <apex:outputText value="{!l.title}"/>                  
        </apex:column>
        <apex:column width="200px" >
            <apex:facet name="header">Company</apex:facet>
            <apex:outputText value="{!l.company}"/>                   
        </apex:column>
        
     
        <apex:column >
            <apex:facet name="header">Campaign Most Recently Responded To</apex:facet>
            <apex:repeat value="{!l.CampaignMembers}" var="cm">
                <apex:outputField value="{!cm.Campaign.Name}"/>
            </apex:repeat>  
        </apex:column>
      
       <apex:column >
            <apex:facet name="header">Response Date</apex:facet>
            <apex:repeat value="{!l.CampaignMembers}" var="cm">
                <apex:outputField value="{!cm.FirstRespondedDate}"/>
            </apex:repeat>   
        </apex:column>

    </apex:pageBlockTable>

------------- End VisualForce Snippet -----------------



------------- Start Apex Controller Snippet -----------------
    public ApexPages.StandardSetController ssc {
        get {
            if(ssc == null) {
                if (userQuery == 'All') {
                    ssc = new ApexPages.StandardSetController(Database.getQueryLocator(
                        [SELECT id, name, status, owner.id, owner.name, rating, title, company,
                            (SELECT Campaign.name,Campaign.status, FirstRespondedDate,HasResponded FROM CampaignMembers
                               WHERE NOT FirstRespondedDate = null
                               ORDER BY FirstRespondedDate DESC
                               LIMIT 1)
                        FROM Lead
                        WHERE Owner.UserRole.Name like '%sales%' AND (Rating = 'A' OR Rating = 'B') AND IsConverted = false AND ( NOT ( Status = 'Nurture' OR Status = 'Unqualified' ) )
                        ORDER BY LastModifiedDate DESC]));
                }
                else { 
               
                    if (userQuery == '') {userQuery = UserInfo.getUserId();}
                     
                    ssc = new ApexPages.StandardSetController(Database.getQueryLocator(
                        [SELECT id, name, status, owner.id, owner.name, rating, title, company,
                            (SELECT Campaign.name,Campaign.status, FirstRespondedDate,HasResponded FROM CampaignMembers
                               WHERE NOT FirstRespondedDate = null
                               ORDER BY FirstRespondedDate DESC
                               LIMIT 1)
                        FROM Lead
                        WHERE owner.id =:userQuery AND (Rating = 'A' OR Rating = 'B') AND IsConverted = false AND ( NOT ( Status = 'Nurture' OR Status = 'Unqualified' ) )
                        ORDER BY LastModifiedDate DESC]));                   
                    }                                                     
                ssc.setPageSize(20);
            }
            return ssc;
        }
        set;
    }
   
    public List<Lead> getLeads() {
        leads = (List<Lead>) ssc.getRecords();
        return leads;
    }

------------- End Apex Controller Snippet -----------------

Is there a way to use the Google Doc authentication that a Salesforce org already has to store/retrieve documents from an organization's exisitng Google Doc account?

 

If not, the example of authenication shows a visualforce page to capture and generate the authenication token.   Is it possible to do the authenication instead in an apex class where the account name and password would come from the "Configuration" object instead.  If so, can someone post an example of how this is done.

Hi ,

 

I am fetching data from salesforce objects in apex class and I want to display it with the help of JSON in VF Page. Is there any plugin or transformer class which can transform them into JSON array for display

 

Help will be appreciable

 

Regards

 

Praz

I'm trying to build an inventory catalog from some data stored in a custom object in Salesforce. One of the fields on the custom object stores the Id of a document that is an externally available image.

 

I'm trying to build this catalog in a Sites page and make this image appear. I'm currently doing this:

 

 

<apex:image url="/servlet/servlet.FileDownload?file={!Inventory__c.Image_URL__c}" />

 This works fine when I'm logged into Salesforce and viewing the Visualforce page directly.

 

Once I navigate to the sites page and try to view it, nothing comes up. I'm confirmed that the image is externally available, and I've set the Sites profile to "Read" for Document objects.

 

Does anyone know how you actually take advantage of externally available images and make them VISIBLE externally?

 

can anybody suggest me where can i download google visualizations App from.I tried in App Exchange but i didnt find it.

Seems like the guide is trying to be clear about this, but not for me. Most of the examples in other questions I've found about this topic are WAYYYY too long to read through, so I'll try to make mine simple:

 

Here's the first part of my controller extension:

 

 

public class Controller_OppItemEdit_OverRide
{

OpportunityLineItem OLI public Controller_OppItemEdit_OverRide (ApexPages.StandardController stdController) { this.OLI = (OpportunityLineItem)stdController.getRecord(); }

Now according to the APEX Guide:

"Note that only the fields that are referenced in the associated Visualforce markup are available for querying on this SObject. All other fields, including fields from any related objects, must be queried using a SOQL expression."

 

That would seem to mean that if I reerence a field that is on the Controller Object in the VF Page, I don't have to query for it using SOQL. But from my experence, I'm not sure I believe this. To continue:

 

 

public OpportunityLineItem getOLI()
    {
    	return OLI;
    }
    
    public void setOLI(OpportunityLineItem LI)
    {
    	this.OLI = LI;
    }

 

 

Adding these getter and setter methods or the standard Controller seems redundant to me, but someone else did this in an example and said it worked for them in their instance, so I include it here. Maybe that;s the problem, maybe not - I don't know.

 

 

public PageReference Save()
    {
system.debug('MRC is '+OLI.MRC__c+' and NRC is '+OLI.NRC__c);
    	
OLI.TotalPrice = OLI.MRC__c + OLI.NRC__c;
    	
update OLI;

return null;

}

 

 

That's it for the Controller code in its simplest form. All of the fields are referenced in the VF Page as inputFields. So, I would assume that if I change one of those inputFields, and click a button that calls an Update to the record, that the record would be updated with the new values.

This assumption is clearly wrong as the record does not get updated.

Here is the essence of the Page:

 

 

<apex:page standardController="OpportunityLineItem" extensions="Controller_OppItemEdit_OverRide" >
<apex:form >
<apex:outputPanel id="thePanel">
<apex:pageBlock id="theBlock" >
<apex:pageBlockButtons >

<apex:CommandButton action="{!save}" value="Save Changes" rerender="thePanel"/>

 </apex:pageBlockButtons>
<apex:PanelGrid columns="2"> New MRC:&nbsp; <apex:inputField value="{!OpportunityLineItem.MRC__c}"/> New NRC:&nbsp; <apex:inputField value="{!OpportunityLineItem.NRC__c}"/> </apex:PanelGrid> </apex:pageBlock> </apex:outputPanel> </apex:form> </apex:page>

  So that's pretty much it. I add a value to the inputField, and click the Save button. The values in the page remain, however the debug statement indicates the values being set are still null, even though the debug log says the update went through as expected. Nows the previously saved values for the record are appearing in the page, but the new values do not appear to be getting to the database.

 

To resolve this I added a query for the Line Item record in the Constructor method:

 

 

OpportunityLineItem OLI;

public Controller_OppItemEdit_OverRide (ApexPages.StandardController stdController) 
    {
        this.OLI = (OpportunityLineItem)stdController.getRecord();
         OLI=[SELECT id, OpportunityID, MRC__c, NRC__c, ...
    		 FROM OpportunityLineItem
    		 WHERE id = :OLI.id];
    }

// And then I added individual properties for each of the fields:

    public decimal MRC {get; set;}
    public decimal NRC {get; set;}

 

 

Now, I can change the inputFields into InputText boxes in the page. And because there is now a property to receive and provide these values, I can now set the OLI record values from the properties:

 

 

public PageReference Save()
    {
        if (MRC != null)
    		OLI.MRC__c = MRC;
    	if (NRC != null)
    		OLI.NRC__c = NRC;
    update OLI;
    }

 

 

This does update the values in the record, which is great - except that I'm having to write customized logic for what should be already available by virtue of using a standard controller and inputFields. I would go ahead and use this except that one of the fields I need is a picklist, and setting up the SelectOptions for a field that is already available on the object means the list of values has to be updated whenevfer someone changes them in SFDC. I realize I could write some long getDescribe method to extrsact the current set of field values, but that seems kind of stupid in this case.

When I add the inputField for this field, all of the current options are already availavble for selection - except the selection doesn't save.

 

I can only guess at this point that I'm declaring the extension incorrectly, or overwriting something but the Dev guide is pretty clear:

 

 

public class myControllerExtension {

    private final Account acct;
    
    public myControllerExtension(ApexPages.StandardController stdController) {
        this.acct = (Account)stdController.getRecord();
    }

By the way, above this example is the following statement:

   ApexPages.StandardController sc = new ApexPages.StandardController(sObject);

The example below it doesn't use this statement. Obviously its a way to create and instantiate a new Standard Controller variable, but there is no indication as to why I would want to use this statement, or if I would need to use it, or if the example below is the equivalent of this statement when used as part of an extension.

 

So, in order to actually get the values I input into the inputFields in a page using a StandardController extension, what am I missing??

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

sdf

I am trying to create a trigger that sends an Email Alert (or just an email though Apex code) to the original Idea poster whenever a comment is left for their idea. In looking through the Apex documentation, I noticed it says you can only define triggers for top-level standard objects, but not for standard child objects. When I try to do something like this:

 

 

trigger commentEmail on IdeaComment (after insert) {
// send email code here
}

 

I get "Error: Compile Error: SObject type does not allow triggers: IdeaComment at line 1 column 25". Can anyone point in the right direction to get around this?