• Prashant.Sakhuja
  • NEWBIE
  • 25 Points
  • Member since 2010

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 8
    Replies

Hi,

I have a requirement that I have implemented using apex trigger but need some help to make it scalable.

 

Requirement:

Auto generate Order Line Items when a Order record is created. Count of Order Line Items depends on the attributes of the Order and can vary from 20 to 1500.

 

My Solution:

Apex trigger on Order object that reads the attributes from the record and uses that in SOQL query to generate Order Line Items.

 

Issue #1:

When there are more than 1000 records returned I get an error. to avoid that I have a LIMIT 1000 added to the SOQL statement. However that still is an issue because I dont know which records I am missing from the result set.

 

Issue #2:

When the number of Order Line Items to be created is less than 100 the trigger works fine.

But when the number of Line Items is 100+ (there is only record that enters the Trigger, so there is no scaling of the governor limit.)

I use Limits.getDmlRows() to prevent run time error, but that does not still allow me to create more than 100 Line Items.

 

What I am running into is really two governor limits. The limits scale with record cound but since only 1 record is created new, the limits dont scale.

1. Total number of records processed as a result of DML cannot exceed 100

2. Total number of records retrieved by SOQL queries cannot exceed 1000

 


Expected Solution:

In the Ideal scenario, if based on the Order- 1420 Line Items are required, then the system should be able to generate that whenever such Order record is created.

 

Any help or pointers on this will be appreciated. Thanks in advance!!

 

 


 

Hi,

I have a requirement that I have implemented using apex trigger but need some help to make it scalable.

 

Requirement:

Auto generate Order Line Items when a Order record is created. Count of Order Line Items depends on the attributes of the Order and can vary from 20 to 1500.

 

My Solution:

Apex trigger on Order object that reads the attributes from the record and uses that in SOQL query to generate Order Line Items.

 

Issue #1:

When there are more than 1000 records returned I get an error. to avoid that I have a LIMIT 1000 added to the SOQL statement. However that still is an issue because I dont know which records I am missing from the result set.

 

Issue #2:

When the number of Order Line Items to be created is less than 100 the trigger works fine.

But when the number of Line Items is 100+ (there is only record that enters the Trigger, so there is no scaling of the governor limit.)

I use Limits.getDmlRows() to prevent run time error, but that does not still allow me to create more than 100 Line Items.

 

What I am running into is really two governor limits. The limits scale with record cound but since only 1 record is created new, the limits dont scale.

1. Total number of records processed as a result of DML cannot exceed 100

2. Total number of records retrieved by SOQL queries cannot exceed 1000

 


Expected Solution:

In the Ideal scenario, if based on the Order- 1420 Line Items are required, then the system should be able to generate that whenever such Order record is created.

 

Any help or pointers on this will be appreciated. Thanks in advance!!

 

 


 

We have a custom field in our case called Submitted By.  This field was originally built as Read Only, defaulting to the creator of the case.  However, this was causing workflow issues so we changed it to an editable field.  It is a lookup to the User Table, and the idea is to choose the name of the individual originating the request (often not the creator).  However, any time we choose a name from the table, it changes it back to the creators name.  It must be updated 2x before it will save.  Can anyone help with this?

  • August 16, 2010
  • Like
  • 0

Hi.

In my system I have 2 triggers on one Account.

The problem is that I must ensure the one triggers executes first and the seccont just after it.

How can I do it?

Thanks!

 

  • August 11, 2010
  • Like
  • 0

I'm sure this is easy to do but couldn't find what I needed in my searches.  Looking to trigger an e-mail to the Account Owner when someone else does one of the following:  updates the account record, updates or add a contact record, or adds an opportunity record.  should be easy -- hoping you can share the code or point me to a similar thread where I can start.

 

Thank you,

Joe Alcodray

For using 2 data structure in one query: Is there a possibility to use a SQL-UNION like feature to merge them?

Hi,

 

I have create an application which uses the Salesforce API on our development system. The user account used on the development system uses the 'Salsefoce' license. I would like to use this application on a production system, which user license should I use in production?

 

Thanks,

 

James

Can I create a custom field that is the max of a Date field?  

 

Ed

  • July 30, 2010
  • Like
  • 0