Map Json Data from Integration into Process Variable

I am able query the data that I want from an integration within a process model, but when I try to map the Json results to a CDT process variable, all of the fields are blank.  The keys from the Json dictionary are identical to the names for each field in the CDT. How can I map the Json dictionary into the CDT process variable?

Alternatively, how can I create an expression rule to parse each field from the Json and map each of them to a text process variable? 

the following expression returns all key, value pairs from the Json: a!fromJson(rule!<rule_name>().result.body)

However, the following returns a null value:

a!fromJson(rule!<rule_name>().result.body).keyname1

  Discussion posts and replies are publicly visible

  • +1
    Certified Lead Developer
    in reply to lukevg

    Glad that helped! I don't think a query parameter is going to help you in this specific case since you are already getting the desired result in the result+body. Also, you don't need casting, just choose Convert JSON to Appian value For Response Body Parsing in your Integration Object configuration and save the output of the Integration rule object to a local or ri variable in a!save(). 

  • Thanks! I'm now able to pass the dictionary through the process model.

    However, I am now stuck on trying to pass a list of dictionaries. The ER above that produced the dictionary I wanted now produces a list of dictionaries that share the same keys.

    When I use the same expression as before to create a custom node output for the integration in the process model, it only returns one dictionary instead of all dictionaries. When i check the array box of each field in the CDT to allow multiple values to be passed in, I get the following error: 

    An error occurred while evaluating expression: =pv!APIResults.ID (Invalid index: Cannot index property 'ID' of type Text into null value of type apiResultsData?list) (Data Inputs)

  • 0
    Certified Lead Developer
    in reply to lukevg

    What is the output of a!fromJson(rule!API_Results(null).result.body).args)? Seems like this is resulting in a null value. Once you get the correct value from the body you will be able to index into the ID field, File_Name field, etc.