- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2024 05:27 AM
Hi everyone,
I would like to limit the number of characters a user can input in a chatbot.
For instance, if a user inputted over 200 characters, the alert message would show up in a chatbot.
I tried to create a Virtual Agent Designer by using Script Action which is one of utilities, but it was not correct behaver.
Hopelly, someone help me to create VA Flow correctly.
Thank you
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2024 01:53 PM
In a Text input node, set Input format = Custom then write a simple script as such:
function validate(value) {
var isValid = true;
var errorMessage;
//should be shorter than 200 characters
if (value.length > 200) {
isValid = false;
errorMessage = 'Sorry, the application name should be 200 characters or less';
}
return {
valid: isValid,
error: errorMessage
};
}
Note this validation happens server-side - after the user submits their response - and you cannot do it client-side (before they submit).

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2024 01:53 PM
In a Text input node, set Input format = Custom then write a simple script as such:
function validate(value) {
var isValid = true;
var errorMessage;
//should be shorter than 200 characters
if (value.length > 200) {
isValid = false;
errorMessage = 'Sorry, the application name should be 200 characters or less';
}
return {
valid: isValid,
error: errorMessage
};
}
Note this validation happens server-side - after the user submits their response - and you cannot do it client-side (before they submit).