function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Trigger is not available for this organization.

            var rebateTrigger = new ApexTrigger();
            rebateTrigger.apiVersion = 14.0;
            rebateTrigger.fullName = "Contact.OnUpdateRebateContact";
            rebateTrigger.content = GetResourceFile("SourceCodes.ContactRebateUpdateTrigger.txt");
            metaApi.create(new[] { rebateTrigger });

That is how I try to add a trigger. 
But why do I receive
INVALID_TYPE: This type of object is not available for this organization 

SourceCodes.ContactRebateUpdateTrigger.txt contains trigger source code that is correct. I take its source code and cast it to byte[] to assign to content property.
Help please.

PS. I have a namespace prefix set in my organization. Maybe that's the case?

Message Edited by Doker on 11-30-2008 01:55 PM

Did you ever get this straightened out?

I'm having similar issues attempting to clear out an ORG (remove all triggers and Classes). Both of them give me this error.




"This type of object is not available for this organization"


After all this time:



Although Apex classes and triggers have the Create and Update field properties set to true, a runtime exception occurs if you try to create or update them using the API. Therefore, use the Migration Tool, the user interface, or the IDE to create or update Apex classes or triggers.

You can't use a "create" call on ApexTriggers with the Metadata API, you can only use a deploy call to create them.