Legacy Dev Forum Posts

 View Only

Sign Up

Error en Script - Obtaining Variable from Data Action execution

  • 1.  Error en Script - Obtaining Variable from Data Action execution

    Posted 06-05-2025 19:09

    Anna_B | 2017-12-07 16:07:52 UTC | #1

    Hello, we have implemented a PureCloud data action that just performs the /api/v2/analytics/conversations/{conversationId}/details, in order to retrieve the User Participants Id involved in the conversations.

    It works and runs well by testing it in the Admin\Actions\Test (PureCloud interface). Neverthless, when we try to use it from a Script (custom action), an error occurs when storing the Participant Id value in the custom variable created at Script level

    Input Contracts: { "$schema": "http://json-schema.org/draft-04/schema#", "title": "Conversation by ID", "description": "Conversation by ID", "type": "object", "required": [ "conversationId" ], "properties": { "conversationId": { "type": "string", "description": "conversationId" } } } Output Contracts: { "$schema": "http://json-schema.org/draft-04/schema#", "title": "Output", "description": "", "type": "object", "properties": { "PARTICIPANT_ID": { "type": "string", "title": "participantId", "description": "participantId" }, "ANI": { "type": "string", "title": "ANI", "description": "ANI" } } Request: { "requestUrlTemplate": "/api/v2/analytics/conversations/${input.conversationId}/details", "requestType": "GET", "headers": {}, "requestTemplate": "${input.rawRequest}" } Response: { "translationMap": { "ANI": "$.participants[0].sessions[0].ani", "PARTICIPANT_ID": "$.participants[0].participantId" }, "successTemplate": "{\n \"ANI\": ${ANI}\n , \n \"PARTICIPANT_ID\": ${PARTICIPANT_ID}\n}" }

    It perfectly runs in the PureCloud testing interface, but in the Script it only shows the ANI value, throwing an error while storing the value of PARTICIPANT_ID. This is the configuration of Data Action calls at script level:

    <img src="//inin-prod-use1-developerforum.s3.amazonaws.com/original/1X/eb5a5e38e0e9d7be2496c61b767b8a3aa1250d84.png" width="401" height="390">

    We would need to retrieve the Participants IDs in order to perform further automation through the Script, based on Participant IDs Thank you very much for your help


    Anna_B | 2017-12-07 16:04:55 UTC | #2

    Hello again, finally we succeded in using it at Script level too. We find out that in the "Response - successTemplate", you need to use the same name in both the key & value for PARTICIPANT_ID. In this way, Script is able to retrieve the variable value. Thank you and BR.


    system | 2018-01-07 16:04:57 UTC | #3

    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: 2207