0

For ex In task activitydate is Apr 1st i have to insert only 65 records on that date,using dataloader on that date i have 10 records already there i am inserting 70 records then 55 records get inserted and (already 10 records there)remaining 15 records get error how can do this?If no task on that date add max 65 tasks remaining tasks get error.

1
  • 1
    Please provide the code you created so far. We're not going to do all the work for you, I'm afraid ;-) Apr 4, 2016 at 8:24

1 Answer 1

0

Considering each date in the final loop makes most sense to me:

for (Date d : taskmap.keySet()) {
    Integer excess = taskmapExisted.get(d).size() + taskmap.get(d).size() - 65;
    if (excess > 0) {
        List<Task> tasks = taskmap.get(d);
        for (Integer i = tasks.size() - 1; i >= tasks.size() - excess; i--) {
            tasks[i].ActivityDate.addError('Daily limit 65 records Exceeded'); 
        }
    }
}

(This answer relates to revision 4 of the question that included some code.)

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .