I use the task that is provided by the azure devops custom pipelines to trigger another build by passing the pipeline ID and other few trigger conditions. Below is the task that I use for your reference.
When I use this task, it is triggering a build in the pipeline I mention and gives the link for the triggered build in the logs. But I need the id or the link for that triggered build as an output so that I can use it later to check the status or etc. Would you please help on how to get this.
You can use get latest build REST API in a powershell task to get the build id. Please add the following scripts in your powershell task:
You can use the variable buildid in subsequent tasks. For example:
Write-Host $(buildid)
Update: You can enable the "Store triggered build id's in a variable" option in the Advanced Configuration of the trigger build task:
Then, you can use $(TriggeredBuildIds) in subsequent tasks.