Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Input value substitution" does not work on Input.ChoiceSet in Outlook Actionable Message where style is "expanded" #1733

Closed
beef1218 opened this issue Jul 20, 2018 · 7 comments
Labels

Comments

@beef1218
Copy link

Platform

I use Outlook web version as client and www.requestwatch.com to monitor HTTP requests.

Author or host

I use a 3rd party application to send an email that contains below adaptivecard to outlook:

{
"type":"AdaptiveCard",
"version":"1.0",
"originator":"981df751-1a61-47d6-9b18-ff57408fc9d1",
"style":"emphasis",
"hideOriginalBody":true,
"body":[
{
"type":"Container",
"style":"default",
"items":[
{
"type":"TextBlock",
"text":"Andy test",
"weight":"bolder",
"size":"medium"
},
{
"type":"Container",
"items":[
{
"type":"TextBlock",
"wrap":true,
"text":"Question 1"
},
{
"type":"Input.ChoiceSet",
"id":"1",
"style":"compact",
"choices":[
{
"title":"Choice 1",
"value":"1"
},
{
"title":"Choice 2",
"value":"2"
},
{
"title":"Choice 3",
"value":"3"
}
]
}
]
},
{
"type":"Container",
"items":[
{
"type":"TextBlock",
"wrap":true,
"text":"Question 2"
},
{
"type":"Input.ChoiceSet",
"id":"2",
"style":"expanded",
"choices":[
{
"title":"Choice 1",
"value":"1"
},
{
"title":"Choice 2",
"value":"2"
},
{
"title":"Choice 3",
"value":"3"
}
]
}
]
}
]
}
],
"actions":[
{
"method":"POST",
"title":"Submit",
"type":"Action.Http",
"headers":[
{
"Content-Type":"application/json"
}
],
"url":"https://www.requestwatch.com/w/4d9wrjen",
"body":{
"1":"{{1.value}}",
"2":"{{2.value}}",
"type":"survey"
}
}
]
}

In this adaptive card, I have 2 Input.ChoiceSet with IDs as "1" and "2".
"1" has style as "compact" and "2" has style as "expanded".

Issue

After I selected my choices in outlook and send the HTTP request back, in the payload I can see {{2.value}} is empty. The input substitution did not work for Input.ChoiceSet where style is "expanded".

@mavarshn
Copy link

In the "Action.Http" object, value of property "body" has to of type string. Instead you are passing a json object as value. Simply serialize you body object in to string and use that as value for "body" property.
Here is the same AdaptiveCard Json with fixed body value -

{
"type": "AdaptiveCard",
"version": "1.0",
"originator": "981df751-1a61-47d6-9b18-ff57408fc9d1",
"style": "emphasis",
"hideOriginalBody": true,
"body": [
{
"type": "Container",
"style": "default",
"items": [
{
"type": "TextBlock",
"text": "Andy test",
"weight": "bolder",
"size": "medium"
},
{
"type": "Container",
"items": [
{
"type": "TextBlock",
"wrap": true,
"text": "Question 1"
},
{
"type": "Input.ChoiceSet",
"id": "1",
"style": "compact",
"choices": [
{
"title": "Choice 1",
"value": "1"
},
{
"title": "Choice 2",
"value": "2"
},
{
"title": "Choice 3",
"value": "3"
}
]
}
]
},
{
"type": "Container",
"items": [
{
"type": "TextBlock",
"wrap": true,
"text": "Question 2"
},
{
"type": "Input.ChoiceSet",
"id": "2",
"style": "expanded",
"choices": [
{
"title": "Choice 1",
"value": "1"
},
{
"title": "Choice 2",
"value": "2"
},
{
"title": "Choice 3",
"value": "3"
}
]
}
]
}
]
}
],
"actions": [
{
"method": "POST",
"title": "Submit",
"type": "Action.Http",
"headers": [
{
"Content-Type": "application/json"
}
],
"url": "https://www.requestwatch.com/w/4d9wrjen",
"body": "{"1": "{{1.value}}", "2": "{{2.value}}","type": "survey"}"
}
]
}

@beef1218
Copy link
Author

beef1218 commented Jul 20, 2018

Hi @mavarshn
I actually did try JSON.stringify() with the Action body. However the value substitution still does not work on my question#2. If I simply change style from "expanded" to "compact", it works fine.
Thanks,
Andy

@mavarshn
Copy link

I just tested with the payload. I replaced the action endpoint with my test service and you can see the value being passed to the service are correct. Use following payload and go to the service and checkout the body value being passed - https://actionsplayground.azurewebsites.net/workspaces/CL04WzSFxEKS9mT_NBhBog#

{
"type": "AdaptiveCard",
"version": "1.0",
"originator": "981df751-1a61-47d6-9b18-ff57408fc9d1",
"style": "emphasis",
"hideOriginalBody": true,
"body": [
{
"type": "Container",
"style": "default",
"items": [
{
"type": "TextBlock",
"text": "Andy test",
"weight": "bolder",
"size": "medium"
},
{
"type": "Container",
"items": [
{
"type": "TextBlock",
"wrap": true,
"text": "Question 1"
},
{
"type": "Input.ChoiceSet",
"id": "1",
"style": "compact",
"choices": [
{
"title": "Choice 1",
"value": "1"
},
{
"title": "Choice 2",
"value": "2"
},
{
"title": "Choice 3",
"value": "3"
}
]
}
]
},
{
"type": "Container",
"items": [
{
"type": "TextBlock",
"wrap": true,
"text": "Question 2"
},
{
"type": "Input.ChoiceSet",
"id": "2",
"style": "expanded",
"choices": [
{
"title": "Choice 1",
"value": "1"
},
{
"title": "Choice 2",
"value": "2"
},
{
"title": "Choice 3",
"value": "3"
}
]
}
]
}
]
}
],
"actions": [
{
"method": "POST",
"title": "Submit",
"type": "Action.Http",
"headers": [
{
"Content-Type": "application/json"
}
],
"url": "https://actionsplayground.azurewebsites.net/workspaces/CL04WzSFxEKS9mT_NBhBog#",
"body": "{"1": "{{1.value}}", "2": "{{2.value}}","type": "survey"}"
}
]
}

@beef1218
Copy link
Author

beef1218 commented Jul 20, 2018

Hi @mavarshn

I am not sure why it is working for you but not for me. I must be doing something wrong.

Allow me to clarify a bit:
Basically I have below JSON as my adaptivecard:

{"type":"AdaptiveCard","version":"1.0","originator":"f5b240ef-995d-449f-a1ab-bca7ae0295f3","style":"emphasis","hideOriginalBody":true,"body":[{"type":"Container","style":"default","items":[{"type":"TextBlock","text":"Andy expanded choice","weight":"bolder","size":"medium"},{"type":"Container","items":[{"type":"TextBlock","wrap":true,"text":"New Multiple Selection"},{"type":"Input.ChoiceSet","id":"1","style":"expanded","choices":[{"title":"Choice 1","value":"1"},{"title":"Choice 2","value":"2"},{"title":"Choice 3","value":"3"}]}]}]}],"actions":[{"method":"POST","title":"Submit","type":"Action.Http","headers":[{"Content-Type":"application/json"}],"url":"https://www.requestwatch.com/w/xf6c0e6q","body":"{"1":"{{1.value}}","type":"survey","sysparm_instance_id":"2591c3a7dbd7130004fb57935e96195a","sysparm_action":"submit"}"}]}

I stringify it and inject it into the email I am sending. The full email HTML body looks like below:

<script type="application/adaptivecard+json">{"type":"AdaptiveCard","version":"1.0","originator":"f5b240ef-995d-449f-a1ab-bca7ae0295f3","style":"emphasis","hideOriginalBody":true,"body":[{"type":"Container","style":"default","items":[{"type":"TextBlock","text":"Andy expanded choice","weight":"bolder","size":"medium"},{"type":"Container","items":[{"type":"TextBlock","wrap":true,"text":"New Multiple Selection"},{"type":"Input.ChoiceSet","id":"1","style":"expanded","choices":[{"title":"Choice 1","value":"1"},{"title":"Choice 2","value":"2"},{"title":"Choice 3","value":"3"}]}]}]}],"actions":[{"method":"POST","title":"Submit","type":"Action.Http","headers":[{"Content-Type":"application/json"}],"url":"https://www.requestwatch.com/w/xf6c0e6q","body":"{\"1\":\"{{1.value}}\",\"type\":\"survey\",\"sysparm_instance_id\":\"2591c3a7dbd7130004fb57935e96195a\",\"sysparm_action\":\"submit\"}"}]}</script>

Here is my RequestWatch response and the input value is empty (I did select a value when responding in outlook):
https://www.requestwatch.com/w/xf6c0e6q

If I switch style from "expanded" to "compact", the value returns properly. Am I missing something?

Thanks,
Andy

@mavarshn
Copy link

mavarshn commented Jul 20, 2018 via email

@beef1218
Copy link
Author

beef1218 commented Jul 21, 2018

Sorry I forgot to mention that I removed a question leaving just one choice question in this latest adaptive card. Its ID is "1" with style as "expanded".

@andrewleader
Copy link
Contributor

Closing as stale, please re-open if you still have any issues, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants