Legacy Dev Forum Posts

 View Only

Sign Up

Datadip on PureCloud internal gives an error with variables used in response filter

  • 1.  Datadip on PureCloud internal gives an error with variables used in response filter

    Posted 06-05-2025 18:41

    NielsS | 2018-12-13 17:49:38 UTC | #1

    I tried to build a datadip which searches in Purecloud for a participantId on a conversation with a specific purpose.

    When I put hardcoded in the output the purpose customer, it works. If I change this to $input.purpose which is in the inputs, it says that it is missing end quotes or other similar errors in every way I try to escape the variable. Example:

    10. Apply output transformation: Transform failed to process result using 'successTemplate' template due to error:'Unexpected character ('}' (code 125)): expected a value at [Source: (String)"{"participantId" : }"; line: 1, column: 21]' Template:'{"participantId" : ${successTemplateUtils.firstFromArray("${participantId}")}}'.

    What am I doing wrong?<a class="attachment" href="/forum/uploads/db6296/original/2X/6/623f1747e405e1ed6ceddf0a9e9d8b1da40f3966.json">Get-PureCloud-Email-conversation-participantId-20181213152217.custom.json</a> (1.8 KB)


    Jason_Mathison | 2018-12-13 20:19:06 UTC | #2

    Hi NielsS,

    Could you provide an example of the output you are seeing in test mode along with the purpose you are testing with?

    --Jason


    NielsS | 2018-12-14 09:03:29 UTC | #3

    Hi Jason,

    The code which I try to scan is:

    { "id": "0dba2712-2411-4554-8913-839cbe942aab", "participants": [ { "id": "3d1b517f-06de-40e9-9abf-b37e9e33abd8", "name": "----er", "address": "-----@---.com", "startTime": "2018-12-13T11:37:39.681Z", "connectedTime": "2018-12-13T11:37:39.695Z", "endTime": "2018-12-13T12:41:19.293Z", "purpose": "customer", "state": "disconnected", "direction": "inbound", "disconnectType": "peer", "held": false, "wrapupRequired": false, "queue": { "id": "c3491c95-8091-4588-89cf-6bddac677410", "selfUri": "/api/v2/routing/queues/c3491c95-8091-4588-89cf-6bddac677410" }, "attributes": {}, "provider": "PureCloud Email", "peer": "9621d4bf-8e35-468a-8d6d-832233f9a25a", "subject": "test 3", "messagesSent": 1, "autoGenerated": false, "draftAttachments": [] }, { "id": "7189deaf-83cc-4779-a81a-a6f7168a1ebe", "name": "Email", "address": "----@----.mypurecloud.com", "startTime": "2018-12-13T11:37:39.689Z", "connectedTime": "2018-12-13T11:37:39.719Z", "endTime": "2018-12-13T12:39:52.279Z", "purpose": "acd", "state": "disconnected", "direction": "inbound", "disconnectType": "transfer", "held": false, "wrapupRequired": false, "queue": { "id": "c3491c95-8091-4588-89cf-6bddac677410", "selfUri": "/api/v2/routing/queues/c3491c95-8091-4588-89cf-6bddac677410" }, "attributes": {}, "provider": "PureCloud Email", "peer": "90d4bc4b-111d-403e-aa1f-ecd7eae0f24a", "subject": "test 3", "messagesSent": 0, "autoGenerated": false, "draftAttachments": [] }, { "id": "1d7fad8c-9381-4765-bf70-dfcc1b08a5b8", "name": "name", "address": "----@----.mypurecloud.com", "startTime": "2018-12-13T12:39:52.287Z", "connectedTime": "2018-12-13T12:41:01.601Z", "endTime": "2018-12-13T12:41:19.277Z", "purpose": "agent", "state": "disconnected", "direction": "inbound", "disconnectType": "client", "held": false, "wrapupRequired": true, "wrapupPrompt": "optional", "user": { "id": "8ca1b2cd-42d8-4127-9e4b-e86239d9ef2a", "selfUri": "/api/v2/users/8ca1b2cd-42d8-4127-9e4b-e86239d9ef2a" }, "queue": { "id": "c3491c95-8091-4588-89cf-6bddac677410", "selfUri": "/api/v2/routing/queues/c3491c95-8091-4588-89cf-6bddac677410" }, "attributes": {}, "alertingTimeoutMs": 300000, "provider": "PureCloud Email", "wrapup": { "code": "7fb334b0-0e9e-11e4-9191-0800200c9a66", "notes": "", "tags": [], "durationSeconds": 12, "endTime": "2018-12-13T12:41:31.470Z" }, "peer": "90d4bc4b-111d-403e-aa1f-ecd7eae0f24a", "subject": "test 3", "messagesSent": 0, "autoGenerated": false, "draftAttachments": [] } ], "otherMediaUris": [], "selfUri": "/api/v2/conversations/emails/0dba2712-2411-4554-8913-839cbe942aab" }

    The goal is to read the participantId from a specific 'purpose' in the array. Example: customer, acd, agent.


    Jason_Mathison | 2018-12-14 15:30:05 UTC | #4

    Hi NielsS,

    Thank you for the example! The issue is that the translationMap is not a velocity template, so it does not support variable substitution. This was never a use case we designed for, nor is it currently in our backlog. You can submit this as an idea at https://purecloud.ideas.aha.io

    Since the purpose field only has three possibilities, the workaround that comes to mind is to create a separate data action for each purpose. I don't see any ability to filter what this conversation API returns so I haven't come up with any other solutions.

    --Jason


    NielsS | 2018-12-17 10:20:47 UTC | #5

    Thanks for the confirmation! I will add it to the ideas page.


    system | 2019-01-17 10:20:48 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: 4182