You need to sign in to do that
Don't have an account?
bryansosa01
Too many DML statements: 151 / How to improve my code??
Is there eny way to improve my code in order to process about 30,000 records.
I would appreciate your help.
trigger SetPorcentajesdePerdidasEnCartera on RORAC__c (after insert) { for (RORAC__c rorac : System.Trigger.new) { for( Cartera_de_Credito__c cartera: [select id, Fecha_al__c, Perdida_Esperada_p_Garant_a_Hipotec__c, Perdida_Esperada_p_Garant_a_Prendaria__c, Perdida_Esperada_p_Garant_a_Hipotecaria__c from Cartera_de_Credito__c where Fecha_al__c =: rorac.Fecha_al__c ]) { cartera.Perdida_Esperada_p_Garant_a_Hipotec__c = rorac.Perdida_Esperada_p_Garant_a_Hipotecaria__c; cartera.Perdida_Esperada_p_Garant_a_Prendaria__c = rorac.Perdida_Esperada_p_Garant_a_Prendaria__c ; cartera.Perdida_Esperada_p_Garant_a_Hipotecaria__c = rorac.Perdida_Esperada_p_Garant_a_Hipotecaria__c; update cartera; } } }
Now I get the following error:
hmm not exactly sure how to handle this....I guess you need to write a batch class to handle these update....anyone has a better idea??
search batch paex here:
http://www.salesforce.com/us/developer/docs/apexcode/index.htm
Hope this helps!!
If this answer helped you please hit KUDOS and mark this as solution
Now I am getting the following error:
Variable does not exist rorac.Perdida_Esperada_p_Garant_a_Hipotecaria__c
Please help me I would really appreciate it.
Bryan Sosa.
Use below, It will work for you.
dapanchal:
I am getting the following error:
Incompatible element type Date for collection of ID.
I guess it is because the Field "
is a Date.
I would appreciate if you can help me with this issue.
Thank you very much.