• Vivek S 42
  • NEWBIE
  • 10 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 8
    Replies
Hi, 
In our salesforce environment using informatica we are inserting or updating records in large number of upto 1,50,000 records in parallel mode. (Can not go for serial mode) In turn of these operations triggers get fired and they call each other and some other triggers to perform some insert/update operations. And also there are some workflows which will get fired on when conditions are meet.

From the logs of transaction i can see the job of insert/update getting started with the chunk of 200 records and when entire cycle got complete of what it takes to finish for the 200 records by firing the triggers and inert/updating the other objects. Once first cycle get completed ideally it should end there and a new chunk of records with fresh set of governor limits should start ...thts what i am assuming!! But, after first cycle got completed again a new set of records are trying to get insert/update with in the same single transaction.

Since a new set is also getting chained in the same transaction, after 3 to 4 chunks are done the job is getting failed because of apex cpu time limit exceeded error. Obviously we will face apex cpu timeout since for all chunks of records are getting fired in single transaction and governor limits are not getting reset for each chunk processed.  

Can anyone tell me how this bulk load from informatica behaves with salesforce? example, if i insert 20000 set of records, if salesforce is processing with each size of 200 chunk, then 100 chunks are required to complete this. Is this all 100 chunks comes under single transaction? 

Can anyone provide me the inputs on this. 

Note: my code is complex and critical logic. Code optimization is done. Cannot go for future calls. Wherever i can use future calls i have made all the necessery optimizatons. Cannot go for serial mode. 
Hi,

I have a validation rule to throw error when no. of lines in address more than 4, 
and another one for each line not to have more than 35 char.

both are working fine except in one case, where all the 4 lines with 35 char is trying to save. and i am getting the error as 
 Invalid (Regular expression runtime exceeded for: (.*\r\n.*){4,})

where as (.*\r\n.*){4,} is from my validation rule. pls help me out. 

validation rule for no. of lines (regex( MailingStreet , "(.*\r\n.*){4,}")
Hi,
I am having difficulty in understanding  What is the purpose and difference between Action Function, Remote Action and Action Support. Pls explain with a Example or a scenario. 

thanq.
  1. There is a User, on his Profile he don’t have read permission for Account, but still he is able to see the Accounts, (no extra permission set is given) How?
If we have one related custom object(Folder) on lead which has industry picklist different values. We create custom setting and different records of custom setting and now one field checkbox -isactive.if industry value = technology on Folder object, records should be created automatically  with name of custom setting values where checkbox true and industry value should be associated with records
Hi All, Sorry I'm quit new to Apex coding and I'm sure the answer is staring my in the face.
 have an Apex Class that clones an opportunity with items. When the user clicks "Clone" the VisualForece page button action takes them to an edit screen which is perfect. However once the users Saves the new record it takes them to a blank screen, see below:
New record saved

How can I change my code so that once the users presses "Save" they are taken to the new record created?

I have been working with code from the below post:
https://blog.jeffdouglas.com/2009/11/19/apex-deep-clone-controller/ 



Apex Class
public class OpportunityCloneWithItemsController {

     //added an instance varaible for the standard controller
    private ApexPages.StandardController controller {get; set;}
     // add the instance for the variables being passed by id on the url
    private opportunity OP {get;set;}
    // set the id of the record that is created -- ONLY USED BY THE TEST CLASS
    public ID newRecordId {get;set;}

    // initialize the controller
    public OpportunityCloneWithItemsController(ApexPages.StandardController controller) {

        //initialize the standard controller
        this.controller = controller;
        // load the current record
        OP = (Opportunity)controller.getRecord();

    }

    // method called from the VF's action attribute to clone the OP
    public PageReference cloneWithItems() {

         // setup the save point for rollback
         Savepoint sp = Database.setSavepoint();
         Opportunity newOP;

         try {

              //copy the Opportunity - ONLY INCLUDE THE FIELDS YOU WANT TO CLONE
             OP = [select Id,
                          Accountid,
                          CloseDate,
                          Promised_Delivery_Date__c,
                          Requested_Delivery_Date__c,
                          Description,
                          DocType__C,
                          CurrencyIsoCode,
                          Name,
                          Ownerid,
                          RecordTypeid,
                          Pricebook2id,
                          Campaignid,
                          Probability,
                          StageName,
                          warehouse__c,
                          Delivery_Address_if_diff_from_main_add__c,
                          Invoice_type__c,
                          Type,
                          A6_Combined_Discount__c,
                          A6_Total_Trade_Disc__c,
                          A6_Contributions_and_Provisions__c,
                          O1_2_return_reason__c,
                          Sale_Or_Return_Record__c
                    from Opportunity where id = :OP.id];
             newOP = OP.clone(false);
             newOP.Date_sent_to_warehouse__c = NULL;
             newOP.Sage_status__c ='Not Ready';
             insert newOP;

             // set the id of the new op created for testing
               newRecordId = newOP.id;

             // copy over the line items - ONLY INCLUDE THE FIELDS YOU WANT TO CLONE
             List<OpportunityLineItem> items = new List<OpportunityLineItem>();
             for (OpportunityLineItem OPL : [Select OL.Id, OL.UnitPrice, OL.Quantity, OL.opportunityid, OL.pricebookentryid From OpportunityLineItem OL where Opportunityid = :OP.id]) {
                  OpportunityLineItem newOPL = OPL.clone(false);
                  newOPL.OpportunityId = newOP.id;
                  items.add(newOPL);
             }
             insert items;

         } catch (Exception e){
             // roll everything back in case of error
            Database.rollback(sp);
            ApexPages.addMessages(e);
            return null;
         }

        return new PageReference('/'+newOP.id+'/e?retURL=%2F'+newOP.id);
    }

}

VisualForce Page
<apex:page standardController="Opportunity" extensions="OpportunityCloneWithItemsController" action="{!cloneWithItems}"> <apex:pageMessages /> </apex:page> 
when i change picklist it has to display
   accounts of type picklist selected.
 
Hi Everyone,

I stuck at one place and could not able to resolve the issue.I know what is the issue and where its happening still I am clueless.Actually I am getting System.NullPointerException: Argument cannot be null in Test Class.

Below is my class:
 
global with sharing class Audit {
    
    global String created_by;
    global String reason;
    global String requested_by_customer;
    global String requested_by_type;
    // Returns the number of milliseconds since January 1, 1970, 00:00:00 GMT
    global Long requested_datetime;
    global String requested_method;
    global String others;
    global String source_system;
    
    
    global Consent_History__c getConsentHistory() {
        Consent_History__c consentHistory = new Consent_History__c();
        
        consentHistory.Consent_Change_Created_By__c = this.created_by;
        consentHistory.Change_Reason__c = this.reason;
        consentHistory.Consent_Change_Requested_By_Customer__c = this.requested_by_customer;
        consentHistory.Change_Received_From_Type__c = this.requested_by_type;
        consentHistory.Change_Received_DateTime__c = DateTime.newInstance(this.requested_datetime);
        consentHistory.Change_Received_Method__c = this.requested_method;
        consentHistory.Consent_Change_Others__c = this.others;
        consentHistory.Source_System__c = this.source_system;
        
        return consentHistory;
    }
}

Below is my test class:
@isTest
private class AuditTest {

    static testMethod void getConsentHistory() {
      
        Datetime myDate=System.now();
        
        Consent_History__c consentHistory = new Consent_History__c();
      
        consentHistory.Consent_Change_Created_By__c = 'User1@cochlear.com';
        consentHistory.Change_Reason__c ='Test';
        consentHistory.Consent_Change_Requested_By_Customer__c = 'Customer1';
        consentHistory.Change_Received_From_Type__c ='Professional';
        consentHistory.Change_Received_DateTime__c = myDate;
        consentHistory.Change_Received_Method__c = 'Consent Card';
        consentHistory.Consent_Change_Others__c = 'Consent Test';
        consentHistory.Source_System__c =Constants.SYSTEM_MCP;
       insert consentHistory;
        
       Test.startTest();
      
       Audit audit=new Audit();
       audit.getConsentHistory();
       Test.stopTest();
        
    }
  
}

I am receiving error at below line in class:
consentHistory.Change_Received_DateTime__c = DateTime.newInstance(this.requested_datetime);

and below line in test class:
audit.getConsentHistory();

I understand that there is something which I am not able to catch for date time in above class which results in returning null value.

Kindly help me to pass this error in my test class.

Any help will be greatly appreciated.

Many thanks in advance

Thanks & Regards,
Maria

​​​​​​​
Hello,

I have a field named, Last_payment__c (date field), is there any possibility to trigger an email if that mentioned field hasn't been updated for a numbers of days? Lets say 7 days. Please advise.

Thanks
Hi,
We are using standard Salesforce action ($Action.Opportunity.New) on custom VF page for Opportunity creation. It works fine in Classic mode but not in Lightning mode. In Lightning mode it shows record type selection. It allows to select avaialble record type. On clicking continue it shows record creation popup, but inside popup it always shows page layout assigned for master record type. Then on clicking save button it shows 'Record Type ID: this ID value isn't valid for the user:'. 

Please, can anyone help me?

How many times a trigger will be executed when try to insert 1000 records to a standard object like Accounts. How to test this? Thank you very much in advance.