Legacy Dev Forum Posts

 View Only

Sign Up

Data actions from API with null values

  • 1.  Data actions from API with null values

    Posted 06-05-2025 18:43

    elena.sanchez-pescad | 2021-10-26 07:35:53 UTC | #1

    Hello Community, I have some issues with the results of a Data Action on Genesys Cloud. I have to call a API (from Zendesk) to get some custom fields data but despite of the API shows "null" values when I access directly to the API url, when I build the data actions this ignores the "null" values. It´s a problem for what i want to develop, I have to get all values from the API, even if the are null or empty.

    Anyone knows any way to get "null" values as the results of the Data Actions instead of nothing as I show on the snapshot?

    Thanks in advance!


    ChrisDibble | 2021-10-26 20:15:36 UTC | #2

    Elena,

    The easiest way to accomplish this is to set default values for your output variables in your architect flow. Once you set an output as a flow variable, you can click on the variable to open the "edit variable" dialog. In that dialog, you can set the initial value. That value will be overridden if there's a new value provided by the data action.

    Here's a screenshot showing the dialog configuration:

    Let us know if that resolves your problem. -Chris


    elena.sanchez-pescad | 2021-10-27 07:16:56 UTC | #3

    Hi @ChrisDibble, thanks a lot for you reply but I think I need a solution in previous steps, more concretely on the Actions.

    If you see the attached file the null values are not shown on the results of the Actions, I mean, they are not empty or null, directly it disapear so even if I define Initial values on the Flow on Architect, this solution isn´t going to work. I think I need first to try to display this values on the result of the Actions even if they are empty, but they have to appear, right? Do you have any idea about how to fix it?

    In addition, and to understand better what I´m looking for in the flow on Architect I have to compare both lists (ids list and value´s list to find what is the "Value" for a specific "Id"´


    Jerome.Saint-Marc | 2021-10-28 08:43:25 UTC | #4

    Hello,

    Depending on your response schema, there can be ways to work around the null value using JSONPath expressions or Velocity macros.

    But the issue/challenge is the fact that your value attribute seems to be taking different types: string, number, boolean. Is this a real set of data/response? Or when you will use this Data Action, will you only get either (string or null) as value, or (boolean or null) or (number or null)?

    If you want to leverage values in your Architect flow, you have to go through Architect variables which must be of a fixed/pre-determine type (number, string, boolean).

    If it is indeed the case (a single type for your response values: numbers or strings or booleans), could you please show the top of your response. Or share the response schema. This is to see under which structure/attributes your objects are available.

    Regards,


    elena.sanchez-pescad | 2021-10-28 10:45:31 UTC | #5

    Thanks @Jerome.Saint-Marc for your reply.

    Yes, they are real data from a Client´s API, and the values can be "null", "string" or "boolean".

    Anyway, i have already found the solution. I have created a two properties where save the Ids and the Values in two arrays:

    "customfieldsids": { "type": "array" }, "customfieldsvalues": { "type": "array" }

    then, on the Configuration of the Action, It gets this values on the TransitionMap as a: "customfieldsids": "$.ticket.custom_fields[].id",* "customfieldsvalues": "$.ticket.custom_fields[].value"*

    This solution gets the two arrays that i need with the same lenght (count the null values)


    system | 2021-11-28 10:44:18 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: 12471