Forum Discussion

ToddChitt's avatar
ToddChitt
Super User
1 year ago
Solved

Set Pipeline Return Code using Dynamic Content

I have a pipeline that has one job: use a Web activity to get an Access Token to be used in other Web activities. Those other web activities in other pipelines so to simplify the design, I want to call the first pipeline from within the second (and many other) pipeline(s). So in the first pipeline, I have a task that sets the Pipeline return value, and for the Value, I put in the dynamic content just as I would if I was setting a Pipeline variable: @activity('Request an Access Token').output.access_token

Note that the dynamic content expression yields the proper value if it is used to set a pipeline varialbe, but when used to set a return code, the result is simple the literal expression of "@activity('Request an Access Token').output.access_token".

 

Question, how do I set a pipeline return value using dynamic content?

  • Going to take a wild guess here.
    Have you changed the type of the pipeline return value to 'Expression' instead of 'string'?


    I did a simple 2 pipeline workflow, the first calls the second and sets a variable based on the return value from the second.  (the second pipeline just has a Get Metadata step and outputs that as its return value.

    Inner pipeline - you've seen the Set Variable in the picture above.

    Outer pipeline

    Outer set variable


    And the audit result


    If this helps, please consider Accepting as a Solution to help others find it more easily.

2 Replies

  • spencer_sa's avatar
    spencer_sa
    Impactful Individual

    Going to take a wild guess here.
    Have you changed the type of the pipeline return value to 'Expression' instead of 'string'?


    I did a simple 2 pipeline workflow, the first calls the second and sets a variable based on the return value from the second.  (the second pipeline just has a Get Metadata step and outputs that as its return value.

    Inner pipeline - you've seen the Set Variable in the picture above.

    Outer pipeline

    Outer set variable


    And the audit result


    If this helps, please consider Accepting as a Solution to help others find it more easily.

    • ToddChitt's avatar
      ToddChitt
      Super User

      Thanks, while I have not tried it yet, I'm 99% sure that is what I missed.

       

       

      Thanks!