+ Start a Discussion
Ashley ZhaoAshley Zhao 

salesforce when batch insert data,the flow can not work.

hey,guys.i meet a problem again.
The detail problem is the following :

Account a1 = new Account(
        Name = 'aiao1',
        Phone = '+34543331',
        Industry = 'Energy',
        Site = '12' );
Account a2 = new Account(
        Name = 'aiao2',
        Phone = '+34543332',
        Industry = 'Energy',
        Site = '34');
Account a3 = new Account(
        Name = 'aiao3',
        Phone = '+34543333',
        Industry = 'Energy',
        Site = '56');
Account a4 = new Account(
        Name = 'aiao4',
        Phone = '+34543334',
        Industry = 'Energy',
        Site = '78');       

List<Account> a6 = new List<Account>();

try {
    insert a6;
catch (DMLException e) {
    System.debug(' DML Exception: ' + e);

when i insert these data, it will trigger a process, and the process will Execute a Flow 
User-added image

the flow will execute the  following :
User-added image
it will create a record,and when the record created success,it will update a field .
when a insert less than 4 records, it will execute successly.
but when the records equal or greater than 4, i will meet a error.
User-added image

so can everyboby help me to solve this ?
very thx.
yours sincely .
James LoghryJames Loghry
Null pointer errors are generally easy to fix.  The hard point sometimes can be finding them.  Do you know which line in your code line 35 pertains to?  Could be the code you showed above, or it could be another trigger or apex class kicked off  by your flow?  
Ashley ZhaoAshley Zhao
hi ,James, the 35 line is that "trigger.new[0].addError(e.getDMLMessage(0));" but i do not how to deal it... could you know how to solve it ? thx..