Unanswered
Hi Kunaal,
For this use case you can leverage message templating.
Our Poll Bot implementation uses a data object which contains answers to a poll, which is a list of strings, https://github.com/SymphonyPlatformSolutions/symphony-poll-bot-java/blob/main/src/main/java/com/symphony/devrel/pollbot/command/CreatePollFormReply.java#L145-L152
// Construct poll form and blast to audience
Map<String, ?> data = Map.of("data", PollBlastData.builder()
.id(poll.getId())
.question(poll.getQuestionText())
.answers(poll.getAnswers())
.creatorDisplayName(poll.getCreatorDisplayName())
.timeLimit(poll.getTimeLimit())
.build());
Message message = Message.builder().content(pollService.getMessage("poll-blast-form", data)).build();
We then use a Freemarker template to iterate on the answers field to produce the respective number of buttons with labels, https://github.com/SymphonyPlatformSolutions/symphony-poll-bot-java/blob/main/src/main/resources/templates/poll-blast-form.ftl#L11-L13
<#list data.answers as answer>
<button name="option-${answer?index}" type="action">${answer}</button><br/>
</#list>
553 Views
0
Answers
one year ago
one year ago
using the above exmaple you can create forms based on the data set that is provided within the data object.
The way you choose to display those data objects in the form is entirely up to you. You could use a dropdown list, radio buttons etc.