Data Action with Array within Scripts not working

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.

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,

2 Likes

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

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,

1 Like

Hi Jerome,

again thanks a lot for your asnwers :slight_smile:

Kind regards,

Nathan.

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