• sdu
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 15
    Questions
  • 12
    Replies
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.
Anyone can tell me what's the best/easiest way to access (read) google analytics data from Apex code (that runs in background)? 

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'

 

 

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??

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

 

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?