+ Start a Discussion
Sales Force FRMSales Force FRM 

How to invoke trigger on custom object

Hi Folks,
                I have created a custom object say "ABC" (App Setup-->create-->Objects) and i want to invoke  a trigger on this ,How to  do this, suggestions welcome. My trigger on custom object "ABC"  is as follows:

trigger ARPTrigger on ABC(after insert) {

}
The above one generated following error:

Error: Compile Error: Invalid SObject type name: ABC at line 1 column 23


Regards,
Rajeshwar.
OnDem DevOnDem Dev

Hi Rajeshwar,

   I guess it should work. Please follow any one the below steps if you were not following.

1)   Click Create--->Objects--->Then click the Custom Object Label.

   You will be taken to the custom object overview page. There you will find a section called Triggers some where in the middle.

   There you try to create the Trigger with the same code by clicking the New button. I checked just now and its working.

2) If you are using Eclipse, then right click on the project name or any of the folder. There you will be given an option to create Trigger. Follow the steps in the wizard.

I hope this will resolve your problem.

Thanks,

OnDemand 



Message Edited by OnDem Dev on 05-28-2008 04:20 AM
JonPJonP
Rajeshwar,

When referencing custom objects from Apex Code, the Web Services API, or SOQL, you must use the object's developer name, which includes the suffix "__c".  So try creating your trigger on "ABC__c" and it should work.

Jon
OnDem DevOnDem Dev

Yes i have done the same and its working for me.

Please check that and redo the steps which i provided.

 

Thanks,

OnDemand

hamstermancerhamstermancer
Hi, I got this one on, "Country" is the name of my custom object, thus the __c, but it still shows me the error for some reason. Any ideas, guys?

Trigger t on Country__c (before insert, before update) {
Country__c[] countries = Trigger.new;
HelloWorldForce.addHelloWorld(countries);
}
hamstermancerhamstermancer
wait here's the exact message, forgot to paste it:

Error: Compile Error: Incorrect SObject type: Country__c should be Account at line 1 column 1