1

Hi I am wondering how I can get the last deployment id from Salesforce, it seems the object is DeployRequest but it is not API accessible?

When I get the id manually, I get the sobject type from the id, which returns DeployRequest.

What I have done in my ant script, is to output the deploy to a file, then use regex to get the deployment id, which is not ideal.

Using the migration tool sf deploy will print out the request id.

Is there a better way.

  • DeployRequest isn't listed in the Object Reference among the very long list of Standard Objects or their fields. – crmprogdev Apr 29 '15 at 15:58
1

Looks like the object you want is RetrieveResult() and is available through metadata API only. See here.

Not sure a call to API is any more effective than parsing it from a file though.

I'm trying to do the same so I can use the ID for a deployRecentValidation action and take advantage of the quick deploy feature. Curious where you end up and would be helpful if you post back on your eventual/ultimate solution.

1
  1. Once you run 'ant deployCodeCheckOnly' in the Terminal, copy the Request ID. See terminal image below: Copy Request ID from Terminal

  2. Paste it in your build.properties file. See Image below: Paste Request ID

  3. Save the build.properties

  4. Now run 'ant quickDeploy'

It will work!

  • just showing a property and not telling where and how its used (in the build.xml) is to a thrash – OK999 Jul 26 '17 at 4:08
0

I messed around some today and ended up with the below.

It is specific to getting the ID for a validation and reusing that ID for deployRecentValidation but you get the idea.

Because it uses all native ant commands I think it is a more clean/efficient way as compared to having to get a session ID and make a callout to the metadata API, process the result...etc.

<target name="validateDeployment">
  <record name="log.txt" action="start"/>
  <sf:deploy username="${sf-target.username}" 
             password="${sf-target.password}" 
             serverurl="${sf-prod.serverurl}" 
             deployRoot="src" 
             checkOnly="true"/>
  <record name="log.txt" action="stop"/>
  <loadfile srcFile="log.txt" property="vid"> 
    <filterchain> 
      <tailfilter lines="1"/>
      <tokenfilter>
        <stringtokenizer suppressdelims="true"/>
        <containsregex pattern="[a-zA-Z0-9]{18}"/>
      </tokenfilter>
    </filterchain> 
  </loadfile> 
  <propertyfile file="build.properties" >
    <entry  key="sf-prod.validationID" value="${vid}"/>
  </propertyfile>
</target>
  • Take care to use the "format code" button to make sure your XML data appears correctly. I've taken care of it for you this time. – sfdcfox Jul 10 '15 at 19:09

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.