disable past date in virtual agent chat bot
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-05-2024 12:56 AM
Hello Dear All - Does anyone give advice or directions on how to write "disable past date" in script section in virtual agent chat bot? Has anyone used date validations scenrios in chat bot? I'm working on catalog item as we cant use UI Policy or catalog client script in virtual agent so is it possbile if we can customized or how to write scripting for disable past date in virtual agent chat bot?
Pls guide/ help me.
Thanks,
Mehak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-05-2024 01:30 AM
Hi @mehak1890
Follow these steps:
1.CREATE A VA TOPIC.
2.ADD DATE PICKER TO TOPIC.
Add a Node: Click on the + button to the conversation flow.
Select: Ask a Question from the node options.
Question Type: Select Date as the question type.
Question Text: Provide the text, for example, "Please select a date".
3.SCRIPT. (to disable past dates)
in "Ask a question" node config, click add script.
(function() {
var today = new Date();
today.setHours(0, 0, 0, 0); // Reset time part to 00:00:00 to ensure only the date part is considered
// Set the minimum date in ISO format (YYYY-MM-DD)
var minDate = today.toISOString().split('T')[0];
// Return the date restrictions
return {
minDate: minDate
};
})();
4.INTEGRATE SCRIPT WITH DATE PICKER.
After integration script into 'Ask a Question' node where the date picker is defined.
Ensure the script returns the minDate property that Virtual Agent will use to restrict past dates.
DONE.
Do the testing and kindly let us know the result.
*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting "Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Shaqeel
****************************************************************************************************************
***********************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting "Accept as Solution" and " Helpful." This action benefits both the community and me.
***********************************************************************************************************************
Regards
Shaqeel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-05-2024 03:56 AM
Hi Shaqeel,
Here we have used the Topic Block activity to call the existing catalog item and that catalog item has a date field. There we need to disable the past date. Basically this is a catalog item field which we are using for the date input in VA.
Can we somehow disable past date for such a catalog item based variable?
Thanks,
Mehak