Legacy Dev Forum Posts

 View Only

Sign Up

Data Action with Array within Scripts not working

  • 1.  Data Action with Array within Scripts not working

    Posted 06-05-2025 19:12

    Nathan_Tossens | 2022-09-20 08:03:20 UTC | #1

    Dears,

    I'm trying to retrieve the list of queues from a certain Division and then feed it into a Dropdwon list into my agent Scripts.

    Here is my Data action output contract + response config :

    Response : { "translationMap": { "ListOfQueueNames": "$.entities[].name", "ListOfQueueIDs": "$.entities[].id" }, "translationMapDefaults": { "ListOfQueueNames": "[]", "ListOfQueueIDs": "[]" }, "successTemplate": "{\"ListOfQueueNames\": ${ListOfQueueNames},\"ListOfQueueIDs\": ${ListOfQueueIDs}}" } Output Contract :

    { "title": "Response", "type": "object", "properties": { "ListOfQueueNames": { "type": "array" }, "ListOfQueueIDs": { "type": "array" } }, "additionalProperties": true }

    When testing it, everything work perfectly.

    Now, I try to use it into my script --> I don't have any Input or Output

    If I change my output contract to string type instead of array, Input and Output are back.

    I assumed that it was possible to retrieve an array from a DA into a String List Types in the Agent script, am I wrong or is something else? Because if I look at this topic

    https://developer.genesys.cloud/forum/t/extract-array-elements-within-script/16274/7 It seems feasible, so what can cause my issue?

    Thanks for your assistance.

    Kind regards,

    Nathan.


    Jerome.Saint-Marc | 2022-09-20 12:57:44 UTC | #2

    Hello,

    I think that modifying your Output Contract like the following should solve your issue.

    { "type": "object", "properties": { "ListOfQueueNames": { "type": "array", "items": { "title": "Queueu Name", "type": "string" } }, "ListOfQueueIDs": { "type": "array", "items": { "title": "Queue ID", "type": "string" } } }, "additionalProperties": true }

    Regards,


    Nathan_Tossens | 2022-09-20 08:45:07 UTC | #3

    Hello Jerome,

    Great it works perfectly !

    Now an additional question

    If I assign a String variable to the value of the dynamically filled dropdown list , I guess it's the selected value in the "value list " right? How can I also retrieve the value of the selected item in the Labels List of the dropdown?

    Kind regards,

    Nathan


    Jerome.Saint-Marc | 2022-09-20 12:57:44 UTC | #4

    Hello,

    "If I assign a String variable to the value of the dynamically filled dropdown list , I guess it's the selected value in the "value list " right?" Correct.

    "How can I also retrieve the value of the selected item in the Labels List of the dropdown?" I don't think it is available. The labels in the Labels list are just for display of the corresponding values in the Values list.

    Regards,


    Nathan_Tossens | 2022-09-20 12:57:40 UTC | #5

    Hi Jerome,

    again thanks a lot for your asnwers :slight_smile:

    Kind regards,

    Nathan.


    system | 2022-10-21 12:58:26 UTC | #6

    This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.


    This post was migrated from the old Developer Forum.

    ref: 16358