• sdu
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 15
    Questions
  • 12
    Replies
In a batch apex class, if I have an oder by clause in the query locator in start method, is it guaranteed that I would get the records in that order? 
  • October 26, 2017
  • Like
  • 0
I have a batch Apex class that makes callout in the executeBatch() method. And I need to schedule this batch to run sometime in the future. So I tried to use a Schedulable class to schedule it. But when I test, I get this error:
Callout from scheduled Apex not supported.

So I search and found a post that says to use @future. So I added that in my schedulable class. But then I get this error:
Database.executeBatch cannot be called from a batch start, batch execute, or future method.

Can someone help me find a solution? Thanks a lot. 
 
  • September 22, 2015
  • Like
  • 0
I am trying to debug my app. It's a batch process so there should be several logs and I need to find info in one of the logs. But somehow, only the most recent 2 (or 4) logs are kept, earlier ones disappears right away. Anyone knows why? 
  • August 06, 2015
  • Like
  • 0
If a company does not use multi-currency, that means all their data would be in a single currency, but that currency doe not have to be USD, it can be any currency I suppose (like CAD)? Where can I find this info (which object/field)? I looked in Organization object, but could not find this info there. Please help.
  • July 06, 2015
  • Like
  • 0
Quick question: is it true that you cannot use developer console or workbench for PE edition??
  • June 09, 2015
  • Like
  • 0
Anyone can tell me what's the best/easiest way to access (read) google analytics data from Apex code (that runs in background)? 
  • June 04, 2015
  • Like
  • 0

When I run the force.com ide installer, keep getting the error JVM terminated: exit code -1. Any has any idea why?

 

  • June 20, 2013
  • Like
  • 0

I am trying to test the new feature in Spring where you can use API to create a new trialforce org. In the example (java) provided, it's using the class SignupRequestInfo. But where/how do I get the jar file for this class? I tried generating jar for tooling WSDL, Apex WSDL, Partner WSDL, but none of them contain this class. Anyone can help me?

 

  • May 01, 2013
  • Like
  • 0

Why following code does not work in Sweden locale?

Decimal d = 12345.67;
String s = d.format();
Decimal dd = Decimal.valueof(s); // throws 'System.TypeException: Invalid decimal: 12 345,67'

 

 

  • December 20, 2012
  • Like
  • 0

Anyone know if that is the salesforce limitation?

  • July 11, 2012
  • Like
  • 0

If I have a master and a child object and there are lots of records in the child object. It is impossible to delete these records in Apex code. The error is 'DELETE_OPERATION_TOO_LARGE, Cascade deleting too many records'.

 

Note that I am using an Apex batch to delete the records from the child object first, then delete the records in the parent object and the error occurs when I try to delete the records in the master object. According to salesforce support, the reason for the error is the child records are still in recycle bin, and when deleting the master records, they need to be moved to another table somehow. If this is the only obstacle, I can delete the records permenantly by using Database.emptyRecycleBin(). But the error still occurs even after I empty the recycle bin. Aparently the records are still somewhere and salesforce still need to do something with them. Only after salesforce support manually cleaned them out, I am able to delete the master records.

 

Salesforce support says this is working as designed. I just do not see this make sense. We are building an app, have lots of customers, and they may need to perform such deletion very often. We have to open ticket with salesforce everytime we hit the error?

  • June 11, 2012
  • Like
  • 0

There are lots of rows in this object, but when I run a query from it in a test method, it is not seeing any rows. Why? How am I suppose to test my code if I cannot see the data??

  • April 18, 2012
  • Like
  • 0

How am I suppose to get enough test coverage if most of my code is doing callouts but test method does not allow callouts??

  • April 18, 2012
  • Like
  • 0

Anyone knows what is the default isolation level and if it is possible to change that? I have a use case as follows: I want to insert a record in an object if it does not exist, otherwise just update it. So I am doing a select (where say name = <some value>), if no record is returned, I create a new one, otherwise I update the existing one. But it appears that if two such calls are executed at the same time, I would end up creating two records (with same name). Anyone knows how to solve this problem?

  • November 21, 2011
  • Like
  • 0

I noticed when running an aggregation query, salesforce automatically converts all currency values into the corporate currency. I understand if the data (the query works on) has more than one currency, you have to convert them into one in order to do the sum or min etc. But in my case, the data is all in one currency (but different from the corporate) so there is no need to convert. Is there a way to turn off the convertion because I want to display the data in user's local currency? Also, I am using dated conversion rates, and my query is on a custom object, how does salesforce pick the conversion rate to use?

  • May 24, 2011
  • Like
  • 0
If a company does not use multi-currency, that means all their data would be in a single currency, but that currency doe not have to be USD, it can be any currency I suppose (like CAD)? Where can I find this info (which object/field)? I looked in Organization object, but could not find this info there. Please help.
  • July 06, 2015
  • Like
  • 0
Anyone can tell me what's the best/easiest way to access (read) google analytics data from Apex code (that runs in background)? 
  • June 04, 2015
  • Like
  • 0

I havent coded apex in a long time, this trigger was working for the past 8 months and then all the sudden we get this:

 

 

Apex script unhandled trigger exception by user/organization: 005U0000000fp0q/00DU0000000Kh8N

 

changeLeadStatus: execution of BeforeInsert

 

caused by: System.NullPointerException: Attempt to de-reference a null object

 

Trigger.changeLeadStatus: line 7, column 1

 

 

Any help would eb appricated

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

trigger changeLeadStatus on Task (before insert, before update) {
    String desiredNewLeadStatus = 'Working - Contacted';

    List<Id> leadIds=new List<Id>();
    for(Task t:trigger.new){
        if(t.Status=='Completed'){
            if(String.valueOf(t.whoId).startsWith('00Q')==TRUE){//check if the task is associated with a lead
                leadIds.add(t.whoId);
            }//if 2
        }//if 1
    }//for
    List<Lead> leadsToUpdate=[SELECT Id, Status FROM Lead WHERE Id IN :leadIds AND IsConverted=FALSE];
    For (Lead l:leadsToUpdate){
        l.Status=desiredNewLeadStatus;
    }//for
    
    try{
        update leadsToUpdate;
    }catch(DMLException e){
        system.debug('Leads were not all properly updated.  Error: '+e);
    }
}//trigger

Why following code does not work in Sweden locale?

Decimal d = 12345.67;
String s = d.format();
Decimal dd = Decimal.valueof(s); // throws 'System.TypeException: Invalid decimal: 12 345,67'

 

 

  • December 20, 2012
  • Like
  • 0

There are lots of rows in this object, but when I run a query from it in a test method, it is not seeing any rows. Why? How am I suppose to test my code if I cannot see the data??

  • April 18, 2012
  • Like
  • 0

I'm wondering is it possible to create Excel or CSV file in apex code (as attachment) is it possible ? currently i only see it works with VF page, but i'm looking to do it in apex code not using vf page, I don't see any options.

 

Any help is appreciated.

 

Thanks

Ram

 

  • December 29, 2011
  • Like
  • 0

Anyone knows what is the default isolation level and if it is possible to change that? I have a use case as follows: I want to insert a record in an object if it does not exist, otherwise just update it. So I am doing a select (where say name = <some value>), if no record is returned, I create a new one, otherwise I update the existing one. But it appears that if two such calls are executed at the same time, I would end up creating two records (with same name). Anyone knows how to solve this problem?

  • November 21, 2011
  • Like
  • 0