Articles → MICROSOFT BOT FRAMEWORK → Describe Attribute In Formflow

Describe Attribute In Formflow






Purpose




Picture showing the Microsoft documentation of describe attribute in form flow in microsoft bot framework
Click to Enlarge


Fields In Describe Attribute




  1. Description - Change the default description of field, property or enum.
  2. Image - Add an image on the card. In this attribute, the URL of an image is specified.
  3. Message - Message to return when a button is pressed in the card.
  4. Title - Specifies the title on the card.
  5. SubTitle - Specifies the subtitle on the card.

Example




[Describe(Description = "the name (written on your PAN card)")]
public string name;




Picture showing the default message when describe attribute is not used
Click to Enlarge

Picture showing the overridden message when describe attribute is used
Click to Enlarge



public enum MaritalStatus { [Describe(Message = "Thank you for selecting the option Married")]
	Married,
	Unmarried,
	Single
}

[Describe(
Description = "Marital Status", Image = "http://gyansangrah.com/ArticleImages/introduction_to_photoshop_three.JPG", Title = "Need for documentation purpose", SubTitle = "Please select between Married/Unmarried/Single")]
public MaritalStatus ? maritalStatus;


Picture showing the marital status card without image, title, subtitle and message
Click to Enlarge

Picture showing the marital status card with image, title, subtitle and message
Click to Enlarge



Picture showing the output when the user clicks on the married option in marital status card
Click to Enlarge


Complete Code


using Microsoft.Bot.Builder.FormFlow;
using System;

namespace Bot_Application1.Dialogs {
	public enum MaritalStatus { [Describe(Message = "Thank you for selecting the option Married")]
		Married,
		Unmarried,
		Single
	}

	[Serializable]
	public class FormFlowDemo { [Describe(Description = "the name (written on your PAN card)")]
		public string name;

		[Describe(Description = "Marital Status", Image = "http://gyansangrah.com/ArticleImages/introduction_to_photoshop_three.JPG", Title = "Need for documentation purpose", SubTitle = "Please select between Married/Unmarried/Single")]
		public MaritalStatus ? maritalStatus;

		public static IForm < FormFlowDemo > GetForm() {
			return new FormBuilder < FormFlowDemo > ().Message("Welcome to support chat system. Please enter the following information to serve you better").Build();
		}
	}
}



Prompt Attribute






[Prompt("What is your marital status")]
public MaritalStatus ? maritalStatus;




Picture showing the output of the prompt attribute in microsoft bot framework
Click to Enlarge


Posted By  -  Karan Gupta
 
Posted On  -  Tuesday, October 13, 2020

Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250