• Alper Ozdamar
  • NEWBIE
  • 10 Points
  • Member since 2019
  • Senior Software Engineer


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 3
    Questions
  • 8
    Replies
I need to send Asynchronous requests to some 3rd party API and that call method should be @future. 
On the other hand, we also want to call this method from Batch class. But Salesforce doesn't allow us to send future method from a batch class?

Any ideas?
 
Hello,
We have a problem while we are inserting small bunch of data to Salesforce via Apex code. It takes 7500 milliseconds to insert it to database. Is this normal? Normally in Java you can insert 67 records into database less than 100 milliseconds. Are we doing something wrong? What is the best approach? 

Here is the code that where we insert Slot objects.  
//validSlots has only 67 records. But takes 7500 ms
if(validSlots != null && validSlots.size() > 0) {
                insert validSlots;
}

Thanks,

Alper Ozdamar
Senior Software Engineer


 

Hello,

I'm experienced Java developer but I'm brand new in Salesforce environment. I have couple of questions related with object oriented architecture. 
I want to design a notification system with Apex code to send email and text messages. I have different scenarios that user create different objects (Appointment, Referral, Task, etc.) and I need to send a Notification for each of them. 
So I think that I need to create a Notification super class and AppointmentNotif. ,ReferralNotif. ,TaskNotif. subclasses which are extended from Notification super class. (I can put common attirbutes to my SuperClass.) And some NotificationManager class can have sendNotification method add gets Notification object as a parameter. So NotificationManager doesn't care about it is a Appointment,Referral or etc. if it is a subclass of Notification object. (polymorphism.) 

As a result , my first question is :
1) In Salesforce and in Apex environment can I design my classes like I did in object-oriented architecture.
2) Does Salesforce encourge me to that or Will I experience hard time to do that ? 

Thanks,

Alper 
 

I need to send Asynchronous requests to some 3rd party API and that call method should be @future. 
On the other hand, we also want to call this method from Batch class. But Salesforce doesn't allow us to send future method from a batch class?

Any ideas?
 
Hello,
We have a problem while we are inserting small bunch of data to Salesforce via Apex code. It takes 7500 milliseconds to insert it to database. Is this normal? Normally in Java you can insert 67 records into database less than 100 milliseconds. Are we doing something wrong? What is the best approach? 

Here is the code that where we insert Slot objects.  
//validSlots has only 67 records. But takes 7500 ms
if(validSlots != null && validSlots.size() > 0) {
                insert validSlots;
}

Thanks,

Alper Ozdamar
Senior Software Engineer


 
how to insert multiple records using dynamic apex in salesforce

Has anyone noticed whether inserting records into a list-type custom setting takes a long time?

 

I have a managed package that includes 4 custom settings, as well as a trigger that expects the custom settings to be populated with certain records. When the trigger starts, it checks whether the custom settings are populated, and if not, it populates them, inserting about 350 records total, split among the 4 custom settings. It inserts the custom settings using standard Apex techniques for inserting records -- it constructs a List<My_Custom_Setting__c> and then inserts the list with a since insert statement.

 

One of the custom settings gets populated with about 250 records. Checking the debug logs, I see that it often takes 5 minutes or more for that one insert operation to complete. That, combined with the time it takes to populate the other 3 custom settings, sometimes pushes the trigger over the 10-minute-per-transaction limit. 

 

I know I can use a Visualforce page to populate the custom settings, and just tell people who install the package to load that page to complete the installation. But I'm more interested in why it takes 5 minutes or more for a single insert statement to create 250 custom setting records. Has anyone else seen that kind of performance issue? Any thoughts on what I could do to avoid it?

  • November 17, 2011
  • Like
  • 1

Has anyone noticed whether inserting records into a list-type custom setting takes a long time?

 

I have a managed package that includes 4 custom settings, as well as a trigger that expects the custom settings to be populated with certain records. When the trigger starts, it checks whether the custom settings are populated, and if not, it populates them, inserting about 350 records total, split among the 4 custom settings. It inserts the custom settings using standard Apex techniques for inserting records -- it constructs a List<My_Custom_Setting__c> and then inserts the list with a since insert statement.

 

One of the custom settings gets populated with about 250 records. Checking the debug logs, I see that it often takes 5 minutes or more for that one insert operation to complete. That, combined with the time it takes to populate the other 3 custom settings, sometimes pushes the trigger over the 10-minute-per-transaction limit. 

 

I know I can use a Visualforce page to populate the custom settings, and just tell people who install the package to load that page to complete the installation. But I'm more interested in why it takes 5 minutes or more for a single insert statement to create 250 custom setting records. Has anyone else seen that kind of performance issue? Any thoughts on what I could do to avoid it?

  • November 17, 2011
  • Like
  • 1