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
DokerDoker 

Trigger is not available for this organization.

Code:
            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
JPClarkJPClark

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.

 

Jeff

 

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

JPClarkJPClark

After all this time:

 

Note

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 Force.com Migration Tool, the Salesforce.com user interface, or the Force.com IDE to create or update Apex classes or triggers.
adamproadampro

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