4

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

2 Answers 2

3

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.

3
  • Thanks for the answer. I'll try what you suggest tommorow.
    – vortex
    Commented Apr 15, 2015 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
    Commented Apr 16, 2015 at 6:29
  • Hi @vortex thanks for the correction. I have updated the answer.
    – gaiser
    Commented Apr 16, 2015 at 6:45
0

For the latest version of Salesforce API: v60.0

The content of the zip file must be as follows

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .