TobiasJunghans | 2021-03-08 15:07:00 UTC | #1
Hi everybody! I have created a data action to search for an external contact by a value, which is working fine with all my tests but if I use this data action in architect it is working as long I only configure variables (like Task.firstName) which are strings. If I configure for example the response of my data action with variable Task.workPhone, which is EC variable workPhone.e164 then data action fails and response value is not set/filled. My data action looks like following:
Output contract:
{ "title": "entities", "type": "object", "properties": { "id": { "type": "string" }, "firstName": { "type": "string" }, "lastName": { "type": "string" }, "workEmail": { "type": "string" }, "workPhone": { "type": "object", "properties": { "e164": { "type": "string" } }, "additionalProperties": true }, "cellPhone": { "type": "object", "properties": { "e164": { "type": "string" } }, "additionalProperties": true }, "address": { "type": "object", "properties": { "address1": { "type": "string" }, "city": { "type": "string" }, "postalCode": { "type": "string" }, "countryCode": { "type": "string" } }, "additionalProperties": true }, "customFields": { "type": "object", "properties": { "employeeididentifier": { "type": "string" } }, "additionalProperties": true } }, "additionalProperties": true }
Response:
{ "translationMap": { "firstName": "$['entities'][0]['firstName']", "lastName": "$['entities'][0]['lastName']", "workEmail": "$['entities'][0]['workEmail']", "city": "$['entities'][]['address']['city']", "street": "$['entities'][]['address']['address1']", "countryCode": "$['entities'][]['address']['countryCode']", "postalCode": "$['entities'][]['address']['postalCode']", "workPhone": "$['entities'][]['workPhone']['e164']", "employeeId": "$['entities'][]['customFields']['employeeididentifier']", "id": "$['entities'][0]['id']", "cellPhone": "$['entities'][*]['cellPhone']['e164']" }, "translationMapDefaults": { "firstName": "\"UNKNOWN\"", "lastName": "\"UNKNOWN\"", "workEmail": "\"UNKNOWN\"", "city": "\"UNKNOWN\"", "street": "\"UNKNOWN\"", "countryCode": "\"UNKNOWN\"", "postalCode": "\"UNKNOWN\"", "workPhone": "\"UNKNOWN\"", "employeeId": "\"UNKNOWN\"", "id": "\"UNKNOWN\"", "cellPhone": "\"UNKNOWN\"" }, "successTemplate": "{\"id\": ${id},\"firstName\": ${firstName},\"lastName\": ${lastName},\"workEmail\": ${workEmail},\"workPhone.e164\": ${workPhone},\"cellPhone.e164\": ${cellPhone},\"address.address1\": ${street},\"address.city\": ${city},\"address.postalCode\": ${postalCode},\"address.countryCode\": ${countryCode},\"customFields.employeeididentifier\": ${employeeId}}" }
How can I configure variables for my object variables of data action? Can somebody give me a hint what I've done wrong?
Thanks a lot! Tobias
Jason_Mathison | 2021-03-08 16:19:36 UTC | #2
HI TobiasJunghans,
I am not sure what you mean by "EC variable".
If you are trying to get the phone number into an architect phone number variable type, I would guess that you need to return the phone number as a string, and then use an "Update Data" step in the data action success path in order to process the phone number with the Architect ToPhoneNumber("tel:+1") method. If that doesn't work I will move this thread to the Architect room to get them engaged.
--Jason
TobiasJunghans | 2021-03-09 09:13:18 UTC | #3
Hi Jason,
EC variable means External Contacts output variable. My problem is that my data action is working without any issues (all output variables are filled with data) if I test the data action but if I use this data action in architect and configure a variable for each output variable (in architect I can only set string variables) with for example Task.firstName, Task.lastName and Task.street (for entities[*].address.address1 output variable data action fails (goes out of error path) and so I can't use "Update data" step in success path. How can I set a different variable type in call data action step in architect or how should I configure my data action output contract to get it running in architect, taht i can use the output variables as string? Best regards, Tobias
Jason_Mathison | 2021-03-09 12:25:18 UTC | #4
Hi Tobias,
A couple of things would make it easier to reproduce this issue. The first is, please export your action and attach it to this thread as a .json file. This is your first post, so you might be restricted from doing that, but I can get your user upgraded today if that is a problem.
Second, please post an example of the response from external contacts that you are having a problem with. Please modify anything sensitive like names or phone numbers. The important part is that the "shape" of the response stay the same, the actual data doesn't matter. This can also be posted as a .json file.
--Jason
Jason_Mathison | 2021-03-09 18:22:19 UTC | #6
Hi Tobias,
I was hoping for the output from step 9 of test mode (Execute), with anything sensitive overwritten.
--Jason
Jason_Mathison | 2021-03-09 19:43:11 UTC | #8
Hey Tobias,
Copying that data and saving it as execution.json and posting that would be easier to deal with, but I will see what I can do with this :slight_smile:
The reason is that in order to reproduce your issue I will take the json and create a mockable.io endpoint with it that I can test your data action against. It ensures that I am testing with exactly the same input as you are, without me having to access your real endpoint.
--Jason
TobiasJunghans | 2021-03-09 19:43:17 UTC | #9
no problem... output#9.json|attachment (453 Bytes)
Jason_Mathison | 2021-03-09 19:45:37 UTC | #10
Crap, can you grab the output from the "execute" step, the purecloud endpoint numbering must be a bit different.
TobiasJunghans | 2021-03-09 19:51:01 UTC | #11
Is this better? output#7.json|attachment (1.6 KB)
Jason_Mathison | 2021-03-09 20:14:11 UTC | #12
Thanks for the execution output, I can now give you some advice :slight_smile:
Here is a new version of your action where I got rid of pretty much all of the translation map work, and instead just return the first entity:
BBraunGetExternalContactbyValue---Exported-2021-03-09--1910-20210309150541.custom.json|attachment (2.5 KB)
This may work for you, however the big down side is that it will not set missing variables to "UNKNOWN", they will simply be missing. This means that in architect you would need to make sure that the variable is set prior to trying to use it.
If that approach doesn't work, then you probably want to make some changes. First, you can flatten your output contract if you want. For example workphone -> e164 could simply be workphone. Second, in your translation maps you probably want to use [0] instead of []. The [] returns an array of values, even if there is only one value. [0] will return a single value as a string. Finally, I think that you were attempting to "hand flatten" your results. You should make your response look like your output contract, and let the Data Action service take care of flattening it to be what architect expects. So you should return { "id" : "id value" ... "address" : { "address1" : "some address" ...} }
not "address.address1" : "some address"
--Jason
TobiasJunghans | 2021-03-09 20:30:44 UTC | #13
Jason_Mathison, post:12, topic:10193
Here is a new version of your action where I got rid of pretty much all of the translation map work, and instead just return the first entity:
Thanks a lot Jason for your response and the new data action! I'm going to try it tomorrow because right now it is 9:30pm in Germany :-). Your answer was very helpful and so I'm able to finalize my architect flow tomorrow! I wish you a nice day at work...
Cheers, Tobias
system | 2021-04-09 20:30:46 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: 10193