Translation Map

Hi,

we are trying to put this api response on genesys to be formatted and be used on architect hope someone can help.

sample response:
{
"nationalIdLastFour": "0006",
"firstName": "DULLY ARI SETIAWAN",
"errorMessage.description": "Success",
"mobileNumber": "62838123456",
"dob": "13051974",
"errorMessage.code": "200",
"listPolicyNumber.policyNumber": [
"4261200838",
"4254780259"
],
"salutation": "Bapak"
}

however we are having trouble on how we can properly handle/translate the response especially on the listPolicyNumber.policyNumber the sample list shows only 2 items but it can be more than 2.

image

On your output contract, for an array, you need to add an entry for what type of values are going to be in the array, so in this case it looks like you should add a string type inside of the listPolicyNumber array.

If that doesn't get things working for you, please post the output from the "execute" step of test mode. That will show us the response before your output is flattened.

--Jason

Hi @Jason_Mathison ,

here is the result in the execute

{
"listPolicyNumber": [
{
"policyNumber": "4261200838"
},
{
"policyNumber": "4254780259"
}
],
"firstName": "DULLY ARI SETIAWAN",
"mobileNumber": "62838123456",
"dob": "13051974",
"salutation": "Bapak",
"nationalIdLastFour": "0006",
"errorMessage": {
"code": "200",
"description": "Success"
}
}

what I want to achieve is get all the results of listPolicyNumber.policyNumber into 1 Output separated by comma ( , ) or bar ( | ), in that way I would be able to make a list variable in architect and count the returned values. or is it possible to count the policyNumber on the translation map? because
listing all possible returned policy number in different output could be tedious to do and maintain if there is > 10 return policyNumber. Hope that I'm making sense and you will be able to help me.

Thank for the example output.

You can get a string array of the policy numbers with a templateMap entry like this:
listPolicyNumber[*].policyNumber

You should be able to return in our output contract as an array with string items in it. Architect will handle that as a string array, which should be easy to deal with.

--Jason

Hi @Jason_Mathison ,

thanks and yes I did able to handle it in architect. but I have a problem when the outputs are passed to another flow. in the origin flow the data action response is a collections, then I put that collection to a Set participant Data so I can pass it to another flow. upon transferring to another flow I used Get participant Data to get the output however in 2nd flow it's no longer a collection.

for example:
in 1st flow I invoke the data action and this is the result (from execute steps), when I used Count function something like ToString(Count(Task.ListPolicyNumber)) the result = 5
{
"listPolicyNumber": [
{
"policyNumber": "11111111"
},
{
"policyNumber": "22222222"
},
{
"policyNumber": "33333333"
},
{
"policyNumber": "44444444"
},
{
"policyNumber": "55555555"

}

],
"firstName": "NAME NAME",
"mobileNumber": "12345678",
"dob": "02271994",
"salutation": "Mr.",
"nationalIdLastFour": "1234",
"errorMessage": {
"code": "200",
"description": "Success"
}
}

then I store this data action output to a Set Participant data this is the value: 11111111 22222222 33333333 44444444 55555555
transfer to another flow and use Get Participant Data value same: 11111111 22222222 33333333 44444444 55555555

but when I run ToString(Count(Task.ListPolicyNumber)) = 1 what should I do?

I also need to play any of the selected item within the collection, example in architect I will create a menu something like: We were able to get 5 policy under your name please select what policy you want...
if caller press 3, I should be able to get the 3rd item in the collections.

I would suggest asking your Architect specific questions in the Architect room. And/or you could open a support case if it appears to be acting incorrectly.

--Jason

The reason it is returning a length of 1 is that it is no longer a collection - just a single string.

  1. Set the collection as a string with a delimiter - toString( collectionName, "|" ) // that is a pipe key
  2. set that new string as a partiticipant data item
    In the next call flow
  3. Get that participant data item as a string
  4. Assign it to a collect using Split( StringName, "|" ). You now have your collection back

thanks for the clarification was able get back the collection upon transferring to new flow!

It can be addressed as
$['listPolicyNumber.policyNumber']
so $['listPolicyNumber.policyNumber'][0] for the first item

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.