Genesys Cloud - Main

 View Only

Sign Up

  Thread closed by the administrator, not accepting new replies.
  • 1.  Webservices results populating an array

    Posted 05-06-2020 03:34
    No replies, thread closed.
    Hi guys

    Can anybody point me to a post or article that would help with setting a data/webservices action up that takes results from the json response and populates an array to subsequently loop through in a call flow?

    ie if I send a phone number to a service and it returns a list of all the people living at the address associated with that number and their dates of birth

    so something comes back like :

    "residents":[
      {"firstName":"John""lastName":"Doe","dob","12-01-1999"},
      {"firstName":"Anna""lastName":"Smith","dob","13-02-1998"},
      {"firstName":"Peter""lastName":"Jones","dob","14-03-1997"}
    ]

    I'd want to then loop through each checking dob and do something like if it's the current date, then play "today is .....'s" birthday

    Thanks
    #ArchitectureandDesign
    #Routing(ACD/IVR)

    ------------------------------
    Vaun McCarthy
    NTT New Zealand Limited
    ------------------------------


  • 2.  RE: Webservices results populating an array

    Posted 05-06-2020 10:08
    No replies, thread closed.
    It supports flat output to Architect, so you would have to take that array and flatten it to something, probably pipe-delimited, then parse it back out in Architect based on the pipe delimiter. I think.

    Maybe someone on the Forum at https://developer.mypurecloud.com would have a better idea.

    Or @Richard Schott

    ------------------------------
    George Ganahl GCP (Genesys Cloud), ICCE
    Principal Technology Consultant
    Genesys
    ------------------------------



  • 3.  RE: Webservices results populating an array

    Posted 05-06-2020 10:43
    No replies, thread closed.
    Hi Vaun,

    You can return an array of an object with 3 strings. It's going to show up as three separate collections in Architect, so make sure you get the value from each using the same index while looping through (see example below). It will probably be more work to convert the date to a valid date time to use with the ToDateTime function. You are going to have to parse the current value and format it into a valid format if you cannot modify the API to return a valid format.

    Per Architect Help:
    String text : The String value to convert to a DateTime. The String must be in the following format: YYYY-MM-DDThh:mm:ss[Z|(+|-)hh:mm] where YYYY = 4 digit year, MM = 2 digit month, DD = 2 digit day, hh = 2 digit hour, mm = 2 digit minute and ss = 2 digit second. T is a separator indicating where the time portion starts. [Z|(+|-)hh:mm] represents the offset of the date time from Coordinated Universal Time where Z indicates Coordinated Universal Time (UTC) itself. If "[+|-]hh:mm" is used instead of Z that specifies an offset from UTC.

    For the array, here is an example of how the action would be configured:
    Action Array
    ..and how it will look in Architect
    Architect Collections


    Thanks,
    Daniel McLeod

    ------------------------------
    Daniel McLeod
    Qsect LLC
    ------------------------------



  • 4.  RE: Webservices results populating an array

    Posted 05-07-2020 15:01
    No replies, thread closed.
    Thanks will try that out

    ------------------------------
    Vaun McCarthy
    NTT New Zealand Limited
    ------------------------------