Genesys Cloud - Main

 View Only

Sign Up

  Thread closed by the administrator, not accepting new replies.
  • 1.  Web Survey using participant data

    Posted 10-30-2023 17:41
    No replies, thread closed.

    Hello Community,

    I am currently running into some issues using participant data in survey flows. I have built a script that allows agents to type in the email address of a customer and I give them a simple drop down with "yes, no" depending on if the customer consents on having a survey sent to them. I have built out a data action that pulls both of these answers. The issue I am running into is in the survey flow I try and do a switch based on what the agent put the flow is not recognizing it and is always going down the default path.

    Thank you,



    ------------------------------
    Walter Ferguson
    Bridgecrest Acceptance Corporation
    ------------------------------


  • 2.  RE: Web Survey using participant data

    Posted 10-30-2023 18:54
    No replies, thread closed.

    Hi Walter

    From the screenshots it looks like that Success Output is returning an array (collection) of strings, not a single string value. So converting tostring on the array might not give you a simple yes / no. (The A has a box around it, indicating an array)

    Try retrieving the first item in the array first, eg State.surveryconsent[0] == "yes" or find(state.surveryconsent, "yes") > -1 or GetAt(state.surveryconsent, 0) == "yes" Would pay to do a IsNotSetOrEmpty() check to ensure the list isn't empty beforehand as well.

    Would also suggest you do some tests in the DataAction config area to ensure the data is coming through the way you expect, if you didn't want an array you will need to update the data action.



    ------------------------------
    Anton Vroon
    ------------------------------



  • 3.  RE: Web Survey using participant data

    Posted 10-31-2023 16:53
    No replies, thread closed.

    I went back and tried to update the data action so I just get the "surveyconsent" but am running into an error with my success template.

    {
      "translationMap": {
        "Consent": "participants[3].attributes.surveyConsent"
      },
      "translationMapDefaults": {
        "Consent": "No"
      },
      "successTemplate": "{\"surveyConsent\": \"${Consent}\"}"
    }

    Below is the error I am receiving. 

    Apply output transformation: Transform failed to process result using 'successTemplate' template due to error:'Unexpected character ('Y' (code 89)): was expecting comma to separate Object entries at [Source: (String)"{"surveyConsent": ""Yes""}"; line: 1, column: 22]' Template:'{"surveyConsent": "${Consent}"}'. 



    ------------------------------
    Walter Ferguson
    Bridgecrest Acceptance Corporation
    ------------------------------



  • 4.  RE: Web Survey using participant data

    Posted 10-31-2023 17:51
    No replies, thread closed.

    Hi Walter, 

    DataActions are not my strong suite, yet.

    But, the error is saying it was expecting a comma separated object (ie an array) in the success template.

    Try this "successTemplate": "{\"surveyConsent\":${successTemplateUtils.firstFromArray(\"${Consent}\")}}"

    Default would need updating too

    Developer forum is a great place to check for tips on how to handle these, check this one out for handling defaults

    https://developer.genesys.cloud/forum/t/translationmapdefaults-not-populating-missing-attributes/20176/2

    Someone else might have a better solution.



    ------------------------------
    Anton Vroon
    ------------------------------



  • 5.  RE: Web Survey using participant data

    Posted 11-01-2023 06:41
    No replies, thread closed.

    Hello Walter,

    You're currently only looking at the 4th participant in the conversation ( "Consent": "participants[3].attributes.surveyConsent" ).

    I'm thinking you'll probably run into interactions where this isn't the case, if it gets transferred or overflows between queues etc.

    It might be better to save the result of all participants as an array and then use FindFirst in Architect flow to check if any of the elements is set to "Yes".



    ------------------------------
    Jan Heinonen
    Contact Center Specialist
    GlobalConnect AB
    ------------------------------