2

I'm struggling to deploy Apex trigger using Metadata API from my connected app. I have created package.xml and the two trigger files - one with suffix .trigger and another - triggerName-meta.xml. I was able to convert the ZIP to byte array and pass it to metedata api deploy() method. I have followed the sample java code in the docs and adjust it to C#. The deployResult success is true, but no trigger is available in SF.

Here is my zip structure:

enter image description here

In the docs says that the trigger files should be in folder triggers, but if i create such structure:

package.xml
       triggers\
               TrigerName.trigger
               TrigerName.trigger-meta.xml

The deployResult says that no package.xml file was found.

And here is the deployResult from my code:

enter image description here

I would appreciate any help! Thanks!

EDIT: The Solution for my case

Thanks to gaiser i have resolved my issue. Here's the correct folder structure of the ZIP file:

unpackaged\
           package.xml
           triggers\
                   TrigerName.trigger
                   TrigerName.trigger-meta.xml
1

Your folder structure should look like so (if you are deploying unpackaged stuff)

unpackaged\
       package.xml  
       triggers\
               TrigerName.trigger
               TrigerName.trigger-meta.xml

Replace folder name "unpackaged" with name of your package if you are deploying packaged components.

| improve this answer | |
  • Thanks for the answer. I'll try what you suggest tommorow. – vortex Apr 15 '15 at 16:28
  • Thank you once again! Just a little correction - the package.xml file should be inside unpackaged folder. This way i was able to deploy my triggers. – vortex Apr 16 '15 at 6:29
  • Hi @vortex thanks for the correction. I have updated the answer. – gaiser Apr 16 '15 at 6:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.