Legacy Dev Forum Posts

 View Only

Sign Up

NULL values do not work in string collection

  • 1.  NULL values do not work in string collection

    Posted 06-05-2025 18:43

    somik.mukherjee | 2022-03-03 16:18:37 UTC | #1

    Below is the response of my data action:

    [

    {

    "claimId": 1325,

    "claimNumber": "1325",

    "clientClaimNumber": "IL03-SRO0",

    "contractAssetId": 3652720,

    "assetId": 29,

    "assetName": "Dishwasher",

    "claimStatusId": 4,

    "claimStatusName": "Closed",

    "lossDate": "2021-08-10T00:00:00",

    "claimDecisionBeginDate": null,

    "claimDecisionCompletedDate": null,

    "claimFileCompletionDate": null,

    "claimSetupDate": "2021-08-11T00:00:00",

    "failureCode": null,

    "incidentDescription": "Leaking water into floor",

    "symptom": null

    },

    {

    "claimId": 1326,

    "claimNumber": "1326",

    "clientClaimNumber": "IL03-SRO289",

    "contractAssetId": 3652720,

    "assetId": 29,

    "assetName": "Dishwasher",

    "claimStatusId": 4,

    "claimStatusName": "Closed",

    "lossDate": "2021-08-30T00:00:00",

    "claimDecisionBeginDate": null,

    "claimDecisionCompletedDate": null,

    "claimFileCompletionDate": null,

    "claimSetupDate": "2021-08-30T00:00:00",

    "failureCode": null,

    "incidentDescription": "H/O Amnda Mitchell called in to complaing about the previously job perform onher diswasher she noticed the last saturday 28/ august that again same laking started from the same spot. PLease DO NOT COLLECT TRADE CALLL FEE UNTIL YOU SEND THE FUL DIAGNOSIS.Best contact number 6153106629.",

    "symptom": null

    },

    {

    "claimId": 1598,

    "claimNumber": "1598",

    "clientClaimNumber": "IL03-SR71",

    "contractAssetId": 3652725,

    "assetId": 39,

    "assetName": "Microwave Oven (Built-In)",

    "claimStatusId": 4,

    "claimStatusName": "Closed",

    "lossDate": "2021-08-11T00:00:00",

    "claimDecisionBeginDate": null,

    "claimDecisionCompletedDate": null,

    "claimFileCompletionDate": null,

    "claimSetupDate": "2021-08-11T00:00:00",

    "failureCode": null,

    "incidentDescription": "H/O Amanda Mitchel, Microwave, has a piece thats melting, built in microwave, noticed 8/10/21, working properly before.",

    "symptom": null

    },

    {

    "claimId": 1327,

    "claimNumber": "1327",

    "clientClaimNumber": "IL03-SRO41",

    "contractAssetId": 3652727,

    "assetId": 44,

    "assetName": "Refrigerator INC ICEMAKER",

    "claimStatusId": 4,

    "claimStatusName": "Closed",

    "lossDate": "2021-05-14T00:00:00",

    "claimDecisionBeginDate": null,

    "claimDecisionCompletedDate": null,

    "claimFileCompletionDate": null,

    "claimSetupDate": "2021-05-14T00:00:00",

    "failureCode": null,

    "incidentDescription": "H/O Amanda called in to report issue with Kenmore side by side kitchen refrigerator w/ice maker located in the main floor kitchen, is making very loud squiking noise, even it still working, issue noticed this morning about 5:50, no noise issues before. Model # 10651109110 / Serial # HR22710564. ",

    "symptom": null

    },

    {

    "claimId": 2457,

    "claimNumber": "2457",

    "clientClaimNumber": null,

    "contractAssetId": 36528,

    "assetId": 45,

    "assetName": "Water Heater",

    "claimStatusId": 5,

    "claimStatusName": "Closed",

    "lossDate": "2022-01-18T01:00:00",

    "claimDecisionBeginDate": null,

    "claimDecisionCompletedDate": null,

    "claimFileCompletionDate": null,

    "claimSetupDate": "2022-01-21T12:24:27.84",

    "failureCode": null,

    "incidentDescription": "Water heater only provides hot water for 1 shower or 1 load of laundry, or to run the dishwasher. ",

    "symptom": "Not Heating Water"

    },

    {

    "claimId": 2479,

    "claimNumber": "2479",

    "clientClaimNumber": null,

    "contractAssetId": 3628,

    "assetId": 45,

    "assetName": "Water Heater",

    "claimStatusId": 1,

    "claimStatusName": "In Progress",

    "lossDate": "2022-01-19T01:00:00",

    "claimDecisionBeginDate": null,

    "claimDecisionCompletedDate": null,

    "claimFileCompletionDate": null,

    "claimSetupDate": "2022-01-21T12:35:50.327",

    "failureCode": null,

    "incidentDescription": "water heater no heating water properly",

    "symptom": "Not Heating Water"

    },

    {

    "claimId": 2481,

    "claimNumber": "2481",

    "clientClaimNumber": null,

    "contractAssetId": 3628,

    "assetId": 45,

    "assetName": "Water Heater",

    "claimStatusId": 3,

    "claimStatusName": null,

    "lossDate": null,

    "claimDecisionBeginDate": null,

    "claimDecisionCompletedDate": null,

    "claimFileCompletionDate": null,

    "claimSetupDate": "2022-01-21T12:35:58.317",

    "failureCode": null,

    "incidentDescription": null,

    "symptom": "Not Heating Water"

    },

    {

    "claimId": 1599,

    "claimNumber": "1599",

    "clientClaimNumber": "IL03-SRO17",

    "contractAssetId": 36529,

    "assetId": 47,

    "assetName": "Drytter",

    "claimStatusId": 4,

    "claimStatusName": "Closed",

    "lossDate": "2021-04-26T00:00:00",

    "claimDecisionBeginDate": null,

    "claimDecisionCompletedDate": null,

    "claimFileCompletionDate": null,

    "claimSetupDate": "2021-05-03T00:00:00",

    "failureCode": null,

    "incidentDescription": "H/O Amell called in to report that her May Tag Dryer stopped heating, Issue was about a week ago.",

    "symptom": null

    },

    {

    "claimId": 1500,

    "claimNumber": "1500",

    "clientClaimNumber": "IL03-S26",

    "contractAssetId": 3629,

    "assetId": 47,

    "assetName": "Dryer",

    "claimStatusId": 4,

    "claimStatusName": "Closed",

    "lossDate": "2021-05-17T00:00:00",

    "claimDecisionBeginDate": null,

    "claimDecisionCompletedDate": null,

    "claimFileCompletionDate": null,

    "claimSetupDate": "2021-05-17T00:00:00",

    "failureCode": null,

    "incidentDescription": "dryer is not heating and the unit was working fine until 5/16",

    "symptom": null

    }

    ]

    We need to pull all symptoms and display as a Communicate. Due to few value being NULL, the block errors out in the BOT flow. We have below response configuration:

    { "translationMap": { "claimStatusDescription": "$.[].claimStatusDescription", "failureCode": "$.[].failureCode", "contractAssetId": "$.[].contractAssetId", "claimDecisionBeginDate": "$.[].claimDecisionBeginDate", "claimId": "$.[].claimId", "clientClaimNumber": "$.[].clientClaimNumber", "claimStatusId": "$.[].claimStatusId", "symptom": "$.[].symptom", "lossDate": "$.[].lossDate", "assetId": "$.[].assetId", "claimSetupDate": "$.[].claimSetupDate", "assetName": "$.[].assetName", "claimStatusName": "$.[].claimStatusName", "incidentDescription": "$.[].incidentDescription", "claimNumber": "$.[].claimNumber", "claimFileCompletionDate": "$.[].claimFileCompletionDate" }, "translationMapDefaults": {}, "successTemplate": "{ \"claimId\":${claimId},\"claimNumber\":${claimNumber},\"clientClaimNumber\":${clientClaimNumber},\"contractAssetId\":${contractAssetId},\"assetId\":${assetId},\"assetName\":${assetName},\"claimStatusId\":${claimStatusId},\"claimStatusName\":${claimStatusName},\"claimStatusDescription\":${claimStatusDescription},\"lossDate\":${lossDate},\"claimDecisionBeginDate\":${claimDecisionBeginDate},\"claimFileCompletionDate\":${claimFileCompletionDate},\"claimSetupDate\":${claimSetupDate},\"failureCode\":${failureCode},\"incidentDescription\":${incidentDescription},\"symptom\":${symptom}}" }

    I have tried the below and it does not work:

    • IsNotSetOrEmpty() does not detect as few items are not null.
    • Tried to set default value of the collection and string within the collection and both does not work.

    Is there a way we can replace null with any value using translation map?

    Thanks, Somik Mukherjee


    Jerome.Saint-Marc | 2022-03-03 16:50:41 UTC | #2

    Hello,

    The following post should help: https://developer.genesys.cloud/forum/t/cycle-on-array-in-json-response-with-template/9341/7

    In your Output Contract, change the "type" of your array items to something like ["string", "null"]

    "clientClaimNumber": { "type": "array", "additionalItems": true, "items": { "title": "clientClaimNumber", "type": ["string", "null"] } }

    In your Architect flow, you can use the IsSet function to check if a value in the array/collection is null or not. e.g. assuming that State.myClientClaimNumbers is a variable storing the output of your Data Action for clientClaimNumber (collection of strings) -> Check if the first item is null or not: IsSet(GetItem(State.myClientClaimNumbers, 0)) -> false if the first item is null, true otherwise.

    Regards,


    somik.mukherjee | 2022-03-04 05:30:59 UTC | #3

    Thank you for the suggestions. I did check and found the field is configured to accept both null and string values. I created below logic right after the data action fetches the values:

    When the value is existing, it returns "true" as result. However, when the data at index 0 is null, it errors out and goes into error handling. The problem remains the same.

    Thanks, Somik Mukherjee


    Jerome.Saint-Marc | 2022-03-04 06:49:44 UTC | #4

    Hello,

    I have just done a test from an Architect Chat flow (I don't have a BotFlow in place in my environment) and I don't seem to have a problem with the IsSet() Decision when the first value in the collection is null. With first value is null, it takes the No branch (in my test with chat).

    Could you show what you have in your block 6023? Just in case it is this block which causes the error out. In my test, I tried to set participant data after the Yes and No to track the result back and verify it was indeed working.

    Regards,


    somik.mukherjee | 2022-03-04 07:14:31 UTC | #5

    Hi Jerome,

    It does work in chat flow but not in BOT flow which is strange. The block 6023 has same logic IsSet(GetAt(Flow.symptomfromClaimAPI,0)) for both Yes and No path.

    @AmandaPonsot @MichaelOrr @Nicola_Burns Is this a bug within the BOT flow? We have seen this happening for a while now.

    Thanks, Somik Mukherjee


    Jerome.Saint-Marc | 2022-03-07 08:28:26 UTC | #6

    Just in case, a processing allowing to replace null with a default string.

    In your Response Configuration - in the successTemplate attribute:

    "successTemplate": "#set ( $quo = $esc.quote ) #set($newNull = \"${quo}EMPTY{quo}\" ) { \"claimId\":${claimId},\"claimNumber\":${claimNumber},\"clientClaimNumber\":${clientClaimNumber.replace(\"null\", $newNull)},\"contractAssetId\":${contractAssetId},...."

    The newNull variable is set to "EMPTY" (including quotes). You can then use it on string collections like the following. ${clientClaimNumber.replace(\"null\", $newNull)} allow to replace null with "EMPTY" (or whatever other value you want to use for null).

    Regards,


    Nicola_Burns | 2022-03-04 09:55:25 UTC | #7

    Hi Somik,

    Our engineering team have opened a ticket to look into this for you. Myself or one of the team will get back to you.

    Nicola


    somik.mukherjee | 2022-03-04 12:49:11 UTC | #8

    Hi @Jerome.Saint-Marc :slight_smile:

    It gives me a syntax error:

    ![image

    690x147](upload://9O0VLzneSPbFcRoTUUkcGoRwHUf.png)

    ![image

    690x248](upload://tLbwqGrwLoyhUplGWFw6nMedOzv.png)


    Jason_Mathison | 2022-03-04 13:04:38 UTC | #9

    It looks like you might be missing a $ before the {quo} after EMPTY.


    Jerome.Saint-Marc | 2022-03-07 08:28:26 UTC | #10

    Yes, sorry. I made a mistake copying the string - missing a $ (after EMPTY).

    "successTemplate": "#set ( $quo = $esc.quote ) #set($newNull = \"${quo}EMPTY${quo}\" ) { \"claimId\":${claimId},\"claimNumber\":${claimNumber},\"clientClaimNumber\":${clientClaimNumber.replace(\"null\", $newNull)},\"contractAssetId\":${contractAssetId},...."

    Regards,


    somik.mukherjee | 2022-03-07 04:09:09 UTC | #11

    Hi Jerome and Jason,

    I still see the same error:

    ![image

    690x338](upload://johjCjTzdG2CfMreO8D8TJYdQ69.png)

    ![image

    690x401](upload://hWm1e2rHAGxqwb3GKlpSkzmBczz.png)

    Thanks, Somik Mukherjee.


    Jerome.Saint-Marc | 2022-03-07 07:08:15 UTC | #12

    Hello,

    You are missing a } at the end of your success template. i.e.

    "successTemplate": "... ...,\"symptom\":${symptom.replace(\"null\", $newNull)}}"

    Regards,


    somik.mukherjee | 2022-03-07 08:28:12 UTC | #13

    My bad. I overlooked the braces. Thanks!! It worked.


    system | 2022-04-07 08:28:36 UTC | #14

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