You need to sign in to do that
Don't have an account?
Deloitte IT Admin 2
System.LimitException: DML currently not allowed
Hi, I'm trying to write into a field, Actuals_P1_MOR__c, the number 100 (for example). This field belong to Pipeline_Item__c object. So, at the end, I update the List pl that is made of Pipeline_Item__c records, in order to update every Actuals_P1_MOR__c.
But I get this error:
System.LimitException: DML currently not allowed
Any idea?
Thankyou!
But I get this error:
System.LimitException: DML currently not allowed
for (Pipeline_Item__c p : pl) { if (p.Actual_P1_MOR__c== null){ p.Actual_P1_MOR__c=0; } if (p.Pipeline__r.CurrencyIsoCode=='USD') { p.Rate_to_USD__c=1; } else { p.USD_MOR_1__c=morMap.get('January'); p.USD_MOR_2__c=morMap.get('February'); p.USD_MOR_3__c=morMap.get('March'); if (p.Pipeline__r.CurrencyIsoCode=='EUR') { String cic = 'EUR'; p.Rate_to_USD__c= bemap.get(cic); } else if (p.Pipeline__r.CurrencyIsoCode=='BRL') { String cic = 'BRL'; p.Rate_to_USD__c= bemap.get(cic); } else if (p.Pipeline__r.CurrencyIsoCode=='CAD') { String cic = 'CAD'; p.Rate_to_USD__c= bemap.get(cic); } else if (p.Pipeline__r.CurrencyIsoCode=='PLN') { String cic = 'PLN'; p.Rate_to_USD__c= bemap.get(cic); } else if (p.Pipeline__r.CurrencyIsoCode=='GBP') { String cic = 'GBP'; p.Rate_to_USD__c= bemap.get(cic); } } if (p.Estimate1__c != null) q.Estimate__c += p.Estimate1__c* p.Rate_to_USD__c; if (p.Op_P1__c != null) q.OP__c += p.Op_P1__c* p.Rate_to_USD__c; if (p.Op_P2__c != null) q.OP__c += p.Op_P2__c* p.Rate_to_USD__c; if (p.Op_P3__c != null) q.OP__c += p.Op_P3__c* p.Rate_to_USD__c; if (p.Actual_P1__c != null){ q.Month1__c += p.Actual_P1__c* p.Rate_to_USD__c; if (p.USD_MOR_1__c != null){ q.Month1MOR__c += p.Actual_P1__c*p.USD_MOR_1__c; p.Actual_P1_MOR__c += 100; } else { q.Month1MOR__c = q.Month1__c; } } if (p.Actual_P2__c != null){ q.Month2__c += p.Actual_P2__c* p.Rate_to_USD__c; if (p.USD_MOR_2__c != null){ q.Month2MOR__c += p.Actual_P2__c*p.USD_MOR_2__c; } else { q.Month2MOR__c = q.Month2__c; } } if (p.Actual_P3__c != null) { q.Month3__c += p.Actual_P3__c* p.Rate_to_USD__c; if (p.USD_MOR_3__c != null){ q.Month3MOR__c += p.Actual_P3__c*p.USD_MOR_3__c; } else { q.Month3MOR__c = q.Month3__c; } } } update pl; <---------------------------------
Any idea?
Thankyou!
Is this code return in some trigger?
Thanks
Nitin
<apex:component controller="Edit_Controller" allowDML="true">
It will solve your problem.
Thanks
NItin