2 Replies Latest reply on Nov 13, 2019 3:20 AM by Supriya Shah

    Need more information on how to use FOR loop in BAO

    Supriya Shah
      Share This:

      Hello Team,

       

      Greetings of the Day!!!!

       

      I am currently working on a use case in which Atrium uses the GET process fo Autopilot AD Utilities to call an API. The Response of API contains numerous incidents which are going to be passed one by one as an input in next process.

       

      So in the Response of API i have applied XSLT transformation and this is how it is looking now:

       

      <html>

       

        <body>

       

          <b>

       

            <table>

       

       

      <tr>

       

      <td>INC00**********</td>

       

              </tr>

       

              <tr>

       

      <td>INC00**********</td>

       

              </tr>

       

              <tr>

       

      <td>INC00**********</td>

       

              </tr>

       

              <tr>

       

      <td>INC00**********</td>

       

              </tr>

       

              <tr>

       

      <td>INC00**********</td>

       

              </tr>

       

              <tr>

       

      <td>INC00**********</td>

       

              </tr>

       

              <tr>

       

      <td>INC00**********</td>

       

              </tr>

       

            </table>

       

          </b>

       

        </body>

       

      </html>

       

      I want to apply For Loop so that each INC gets passed one by one as input in next process.

      Can you tell me how can i use For loop here?

       

        • 1. Re: Need more information on how to use FOR loop in BAO
          Aryan Anantwar

          Hi Supriya,

           

          if the above XML you shared is output of your Get_Tickets_Triage process then its quite easy to achieve what you are looking for:

          • Add Assign activity before for loop and using Basic transform get the INC contained elements into a new XML

          this will  generate a new XML from your sample as below:

          <result>

          <td>INC00**********</td>

          <td>INC00**********</td>

          <td>INC00**********</td>

          <td>INC00**********</td>

          <td>INC00**********</td>

          <td>INC00**********</td>

          <td>INC00**********</td>

          </result

          • Use this XML as input to For..loop and put XPATH expression as //td and assign the result to a output context item 'record'
          • In For..loop extract the INC value from the 'record' context item using basic or xpath transform. i.e. string(.) and store the extracted INC value in a context item i.e. 'Incident Number'
          • Now you can pass this Incident number to your 'Assign_Ticket_And_Send_Mail process.
          • For.. Loop will iterate for each of the element in above new XML and each INC will be passed one by one to your processing workflow.

           

          HTH.

           

          Regards,

          Aryan Anantwar

          2 of 2 people found this helpful
          • 2. Re: Need more information on how to use FOR loop in BAO
            Supriya Shah

            Thanks a lot Aryan. I will try it out and let you know. Really appreciate your time and efforts to put-forth the solution.