I am using jenkins pipeline 2.0, and I would like to get another job's latest successful build number.
What's the pipeline syntax to use?
You can get it this way
def buildNumber = Jenkins.instance.getItem('jobName').lastSuccessfulBuild.number
If you get a RejectedAccessException
you will have to approve those methods, see In-process Script Approval