• saikat sarkar
  • NEWBIE
  • 0 Points
  • Member since 2015
  • Salesforce Consultant
  • Concretio Apps Pvt Ltd


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 7
    Replies

Hi everyone,
I am using a batch apex where i am using a custom field from Account which is updated in a trigger.

The batch apex work perfectly when I desactivate the trigger, but when it is active it doens't work and here is the error:

"First error: Update failed. First exception on row 0 with id 001580000049cHmAAI; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, UpdateAcc: execution of BeforeUpdate
caused by: System.NullPointerException: Attempt to de-reference a null ..."


I hope that you could help me please

Thanks in advance.

  • April 18, 2016
  • Like
  • 0
Could any one suggest that how can i get current user name and comare it with one the field of the account which has a lookup with user after trgger insert/update.
I want to show  error and order will not be allowed to be created if there is a hard block on the account object is checked.
no error but hte trigger is not working.
my trigger is:

 trigger ValidateOrder on Order (before insert) {
   
    for(Order occ : Trigger.new){
    if(occ.id!=null)
    {
   occ = [Select Accountid from Order where id =: occ.id];
    system.debug('***********************'+occ);
    Account acc = [Select id,Hard_Block__c from Account where  id=:occ.Accountid];
    system.debug('***********************'+acc);
       if(acc.Hard_Block__c == True)
       occ.addError(' This Order Cannot be created' );
    }
    }
}
Hello ,
I had a requirement where i need to send an email notification 100 days before the contract end date based on the condition.So i have created the workflow rule with the condition and time based workflow ,email alert.Which worked fine.
Now once the 100 days email is sent to the opportunity owner,then their is a field on contract object "SRR" (picklist field - as yes/no).Now the opportunity owner will update the field "SRR" value .
1)If the owners updates the field "SRR" value as "Yes" then an email needs to send to the customer for 45 /30 /15 days before the contract end date.
2)If the owners updates the field "SRR" value as "No" then stop sending  email needs to  the customer .
3)If the owners does not updates the field "SRR" value  within 90 days before the contract end date,then an email needs to be sent to the owner  and superior.
How can i get this filter in WFR .Any help or example very much appreciated.
Hi Guys,

I have developed custom vf page with list of accounts.

My reqirement is to send the email to contacts associated with the accounts,by selecting the account in vf page.please help me achieve this.

Thanks,
Suresh. 
500 status code return from request to 
In Production have some reports what I want is a report to run every month and save it inside a custom folder.
In Open Execute Anonymous Window, I run the following code:
 
    ApexPages.PageReference report = null;
    report = new ApexPages.PageReference('/idProductionReport?excel=printable+view');
    Document document = new Document();
    document.Name = 'ReportTest.xls';
    document.AuthorId = UserInfo.getUserId();
    document.FolderId = idFolderProduction;
    document.body = report.getContent();
    document.ContentType = 'application/vnd.ms-excel';
    insert document;
        
In the line 7 is where it shows EXCEPTION_THROWN [7]|System.VisualforceException: 500 status code return from request to https://naXX.salesforce.com/idProductionReport?excel=printable+view&inline=1

The same code work in Sandbox, but not in production

Thanks
My question might be silly but i am missing something which i am not able to figure it out.
I am having various if,else if statments in my apex class.

which i had written like below.For some reason OR (||) operator is not functioning as expected.
please correct me what am i missing.
if((opp.stagename =='aaa' || opp.stagename=='bbb') && (opp.Description == null ||
    opp.Rate__c == null || opp.Due_Date__c == null)) {
                 system.debug('ENTER IN TO IF');
               }
else if((opp.stagename=='ccc' || opp.Stagename =='ddd') && (Opp.Description ==null ||   opp.Rate__c ==null || opp.Due_Date__c ==null)){
                        system.debug('ENTER IN TO ELSEIF');
}
else if(opp.stagename == 'eee' || opp.stagename =='fff'  || opp.stagename=='ggg' ||
           Opp.stagename == 'hhh' || Opp.StageName == 'Closed Lost' || opp.StageName == 'Closed Won'){ 
        system.debug('ENTER IN TO 2nd ELSEIF')      
  //  THIS IS WHERE I AM FAILING.EVEN THE STATEMENTS IS FALSE,ITS ENTERING TO ELSE IF INSTEAD OF ELSE.rEST ALL WORKS FINE.
         }
 else{ 
// another logic here.
     }



Thank you in advance!