1 Reply Latest reply on Apr 23, 2018 9:22 AM by Aart_Albint

    Looping in a Quick Action

    gtetterton Rookie

      We need to call a URL for each phone number in a list of phone numbers separated by commas (could be any type of list).

      What language is used in a UI Quick Action?

      Is there a way to loop in a UI Quick action?

       

      Here is an example of the command data code we have already written that works for a literal string with the number

       

      {

          Url:"https://myurl/message/outbound/sms/?from=me&to=055555555&content=Hello"

      }

       

      I need something like this, numberlist is passed in

      {

           foreach(number in $(numberlist))

            {

                    Url:"https://myurl/message/outbound/sms/?from=me&to=$(number)&content=Hello"

                    errorhandling here...

           }

      }

        • 1. Re: Looping in a Quick Action
          Aart_Albint Apprentice

          I've solved this with a field of email addresses separated by semi colons which I wanted to use to link employee objects to incidents from emails.

          you cannot loop in QAs I think, so I built a workflow that loops. I did need to add a field to the object.

           

          in brief:

          tempfield in the object Aart_temp (text, 100)

          field I'm parsing: Aart_CCList (text, 320, copied from contained_child Journal#Email.CCAddrList in a QA when the incident is made)

           

          Made a workflow that runs on when n incident is made from an email, it copies the creating email's CC field to my CCList field and subsequently does an IF to check the CCList field, and if it is not empty, runs a QA that looks like this:

           

          1. find if there is more than one entry in the CC list, if so put the first entry (ONLY) into the temp field, else copy the whole thing.
             aart_temp = $(if Find(";",  Aart_CCList,  1) == -1  then Aart_CCList  else Substring0(Aart_CCList,        0,        Number(Find(";",  Aart_CCList,  1))))

          2. then trim spaces off front and end of both fields  [$trim(fieldname) for both fields]

          3. now remove the first (ONLY) entry from the list:
             Aart_CCList = $(if Find(";",  Aart_CCList,  1) == -1  then null  else Substring0(Aart_CCList,        Number(Find(";",  Aart_CCList,  1) + 1)))

          4. then link to the Employee object by email address (you mightn't care about this part)

          5. for debugging purposes, and because this step wipes an address from the CC list every time it's run, insert a child object Note with the address it just tried to add.

           

          The workflow loops the Exit point of the QA back to an IF statement which sees if Aart_CCList is empty. If it is, then it flows down to the next step. if it is not empty, it runs this quickaction on it.

           

          I must warn you I've only been using the product for about two months so it's possible there is a nicer/neater way to do this. But it does work.

          Also I suspect that by now you may have fixed this already, but I spent a day looking for a solution to this myself so it might help whomever else runs into this question.