Salesforce Tooling API - deactivate a trigger

I am trying to deactivate triggers using the toolkit API. I successfully participate in ORG developer. But could not do it in a real org developer. Is this an api error for Salesforce?

Here is the basis of the algorithm,

  • Create a MetadataContainer with a Unique Name
  • save metadatacontainer
  • Create an ApexTriggerMember parameter for Body, MetadataContainerId, ContentEntityId and metadata [apiVersion = 33.0 packageVersions = [] status = "Inactive" urls = nil>]
  • Change metadata ["status"] = "Inactive"
  • save ApexTriggerMember
  • Create / Save ContainerAsyncRequest
  • container to monitor until completed.
  • display errors if necessary

In the sandbox, I confirmed that after requesting the Apex code, enter TriggerMember here that the "Content" field is read-only. I also confirmed that the MetadataContainerId now points to a ContainerAsyncRequest that has a status of Completed

Here are my results, it seems successful, but ApexTrigger never deactivates ContentEntityId = 01q ............. [ApexTrigger I want to deactivate]

Content="<?xml version=\"1.0\" encoding=\"UTF-8\"?>
    <ApexTrigger xmlns=\"urn:metadata.tooling.soap.sforce.com\">
        <apiVersion>33.0</apiVersion>
        <status>Inactive</status>
    </ApexTrigger>" 

Metadata={apiVersion=33.0 packageVersions=nil status="Inactive" urls=nil> attributes=        {type="ApexTriggerMember"
     url="/services/data/v33.0/tooling/sobjects/ ApexTriggerMember/401L0000000DCI8IAO"
  }

}
+4
source share
1 answer

I think you need to deploy the inactive Trigger from Sandbox to Production. You can't just turn off Trigger in Production. This is true even in the user interface.

, Run/Do not Run. , , .

https://developer.salesforce.com/forums/?id=906F0000000MJM9IAO

0

All Articles