You need to sign in to do that
Don't have an account?
Baktash H.
Batchable trigger?
Hello,
i have written a trigger which does a small fieldupdate on the created record. It is after insert.
I did a bit of research about apex batch, but didn't find anything specific to my problem.
No do I need to learn everything about apex batch or can you tell me what i need to know, maybe you can give me links to the knowledge i need.
thanks.
I tried it like in the example:
List<Account> aList = [SELECT Id,(SELECT Name FROM Contracts) FROM Account WHERE Id IN : Trigger.newMap.keySet()];
I made a System.Debug, and aList is empty! How is this possible, the trigger is after insert, and that is the first line.
http://wiki.developerforce.com/page/Apex_Code_Best_Practices
Is this code on the account trigger or somewhere else?
Could you not do this using a workflow rule with field update or a formula field?
If found my mistake, the trigger was on Contract not on account.
Now it looks like this:
trigger tName on Contract (after insert) {
List<Contract> cList = [SELECT Name FROM Contract WHERE Id IN :Trigger.newMap.keySet()];
List<Contract> ContractsToUpdate = new List<Contract>();
for(Contract c : cList){
c.Name = 'something';
ContractsToUpdate.add(c);
}
update ContractsToUpdate;
}
This works if I insert a contract over the pagelayout. How can I test it over the api? Do I need the dataloader?
And what do you think is the limit of contracts which can be inserted, with my solution.