Will_Bellerby | 2019-09-13 13:29:38 UTC | #1
Hello,
I am using an action to update a data table during a flow. This is a caller black list which updates the last time a call was disconnected, and adds to the count of calls disconnected.
The actions works when setting up and testing however fails when it is used during a call.
When I test, the inputs only accept strings which are wrapped in quotes. When unquoted it fails, and I'm guessing this is what's happening during the flow as I can't put quotes around variables.
(Seems I can't upload an attachment so...)
INPUT:
{ "$schema": "http://json-schema.org/draft-04/schema#", "title": "ExternalContactIDRequest", "description": "A Contact ID-based request.", "type": "object", "required": [ "datatableId", "rowId", "KEY", "Name", "Reason", "Count", "LastBlocked" ], "properties": { "datatableId": { "description": "The ID of the datatable to update", "type": "string" }, "rowId": { "description": "The ID of the datatable row to update (the phone number)", "type": "string" }, "KEY": { "description": "The first row of the datatable. Use quotes at start at end of string.", "type": "string" }, "Name": { "description": "The name of the customer. Use quotes at start at end of string.", "type": "string" }, "Reason": { "description": "The reason for being blocked. Use quotes at start at end of string.", "type": "string" }, "Count": { "description": "The count of times the number has been blocked.", "type": "number" }, "LastBlocked": { "description": "The date of the most recent time the number was blocked e.g. DD/MM/YYYY. Use quotes at start at end of string.", "type": "string" } }, "additionalProperties": true }
OUTPUT:
{ "type": "object", "properties": {}, "additionalProperties": true }
REQUEST:
{ "requestUrlTemplate": "/api/v2/flows/datatables/${input.datatableId}/rows/${input.rowId}", "requestType": "PUT", "headers": {}, "requestTemplate": "{\n \"Last Blocked\": ${input.LastBlocked},\n \"Name\": ${input.Name},\n \"Count\": ${input.Count},\n \"Reason\": ${input.Reason},\n \"key\": ${input.key}\n}" }
RESPONSE:
{ "translationMap": {}, "translationMapDefaults": {}, "successTemplate": "${rawResult}" }
Jason_Mathison | 2019-09-13 13:32:09 UTC | #2
Hi Will_Bellerby,
If you export your data action you can attach the resulting .json file to your posting.
You should be able to surround your variables in quotes by surrounding them with \" on each side.
--Jason
Will_Bellerby | 2019-09-16 20:01:09 UTC | #3
Hi Jason,
New users can't add attachments sorry!
Wrapping a variable in quotes inputs the variable name e.g. "Flow.PhoneNumber", where as I want to pass the variables contents e.g. "64211234567" which was set previously.
Cheers
Will_Bellerby | 2019-09-16 20:01:46 UTC | #4
It also seems new users can only add one image per post
Jason_Mathison | 2019-09-17 12:31:33 UTC | #5
HI Will, Sorry about the confusion, I wasn't very clear and I didn't notice that the forum software changed what I typed.
You are correct that you should not include quotes around your variable in architect as that will treat them like a literal string, not a variable.
In your data action you should be able to put quotes around your variables, like this:
"requestTemplate": "{\n \"Last Blocked\": \"{input.LastBlocked}\",\n \"Name\": \"{input.Name}\",\n \"Count\": \"{input.Count}\",\n \"Reason\": \"{input.Reason}\",\n \"key\": \"${input.key}\"\n}" Be careful cutting and pasting what I have above, when you originally posted your request configuration your quotes were messed up by the forum software (which is why I ask people to post the JSON file instead).
--Jason
Will_Bellerby | 2019-09-17 21:44:36 UTC | #6
Thanks Jason,
Using the above, the data action works but I'm now getting the below results in my data table:
For reference, I've left the Phone Number and Count as they were previously, the Phone Number is the KEY and the Count is an integer so it doesn't need quoting.
Will_Bellerby | 2019-09-17 21:46:55 UTC | #7
Here's the action inputs in the flow:
Will_Bellerby | 2019-09-17 21:47:53 UTC | #8
Here's my request template
Jason_Mathison | 2019-09-18 12:52:10 UTC | #9
Hey Will,
The issue with your request template is that the variables that are not working are missing a $ before the {input.foo}
--Jason
Will_Bellerby | 2019-09-18 20:44:14 UTC | #10
Got there in the end! Thanks
I found the KEY for the table also had to be a string, it didn't like being an integer.
For the random Googlers:
system | 2019-10-19 20:44:00 UTC | #11
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: 6016