You need to sign in to do that
Don't have an account?
advlgx
Step by Step.... What do I do to upload a trigger through Eclipse?
Is there a plain english version of how to get your trigger published into a prod org? I am new at doing this and would be interested in a step by step guide to what I am supposed to do. I am getting "code coverage" and "testing" errors when trying to upload the new trigger. What do I have to do to get force.com to accept my deployment of a simple trigger. My code is quite basic, automatically setting the contact owner to the associated account owner:
trigger ContactAcct on Contact (after insert, after update)
{
for (Contact c : trigger.new)
{
Set<Id> aid = new Set<Id>();
aid.add(c.AccountId);
Account accid = [SELECT OwnerId, Name FROM Account where id in :aid];
if(accid.OwnerId <> c.OwnerId)
{
Set<Id> cid = new Set<Id>();
cid.add(c.Id);
Contact con = [select OwnerId,Account.Name from Contact where id in :cid];
con.OwnerId = accid.OwnerId;
update con;
}
}
}
You can get the book as part of the Force.com library. Hope this helps.
So, now how would one, for example, use Execute Anonymous to test the code in a trigger? I find no mention of this process or I missed it. I tried inserting my trigger code in various ways within the system.debug call without success. Do I have to create a whole class and implement my trigger code in the class, then test the class? How would doing that carry over to the system understanding that I tested my trigger, the next time I uploaded it. If I'm missing something, please point out to me, but I do not see any correlation in the developer guide between writing classes and testing them, vs. the code I write and deploy as a trigger.