You need to sign in to do that
Don't have an account?
Maxa
Insert multiple records via trigger
I have follwing trigger
trigger USP on OpportunityLineItem (after insert) { List<Task> task = new List<Task>(); List<OpportunityLineItem> newOpportunityLineItem = new List<OpportunityLineItem>(); for (Integer i = 0; i < Trigger.new.size(); i++) { if (Trigger.new[i].Quantity > 0) { System.debug('triggerfire'); task.add(new Task( WhatId = Trigger.new[i].OpportunityId, OwnerId = Trigger.new[i].Ocid__c, Subject='new task'+ Trigger.new[i].Product_Name__c, ActivityDate= System.today(), ReminderDAteTime = System.Now() ) ); } } insert task; }
What it does is that when new product is added to opportunity it creates a task to our support team to insure they follow up on the product and publish it, it is working fine however, what i need is
when a product is entered with multiple quantities for example 2 or 3 etc.
i want to created that number of tasks one for each product, not sure how it is possible without forcing our sales reps to enter one line item for every product but it would be nearly impossible to do
any help greatly appreciated