Skip to main content
New Idea

Data Validation on Catalog Fields

Related products:Freshservice
  • August 29, 2023
  • 7 replies
  • 188 views

paulroberts89
Top Contributor ⭐
Forum|alt.badge.img+5

Currently it isn’t possible to add data validation to Service Catalog fields. An example would be when asking for a charge code for an item, a standard format could be specified to ensure users provide all the required values. The current form question types are restrictive in that no validation rules are provided at all such as: 

  • Length
  • Syntax
  • Reg. Expression 

7 replies

msconfig87
Top Contributor ⭐
Forum|alt.badge.img+10
  • Top Contributor ⭐
  • September 4, 2023

great idea! currently this is only possible with business rules and there it is very very limited. RegEx would solve it all


Rutger Bockholts
Community Debut
Forum|alt.badge.img+4

You're fully aware of the functionality of Freshservice and indeed we can't handle such things in the Business Rules on that level. To make this use case happen, the only approach is to use JavaScript.

For the regex option, here below is an example script, that have to be added under the existing code in the Footer section of the customer portal.

Line starting with “var required_loc =” have to be adjusted for that service item id, which you can find in the address bar when the service item is opened.

Both lines with “#103_8af78d5d-1e4d-4e20-b177-0f1441e3ac8b” in it, needs to be adjusted to the field id you want to validate.

The line with “let pattern = /^[a-zA-Z]{3}$/;” is using a reg expression to check that only 3 letters are allowed in this text field. If something else is entered, an error message appears under the field with a message in red color “Invalid value entered. Please enter max 3 letters”.

<script>
jQuery(document).on('PageUpdate', function() {
setTimeout(function() {
var current_loc = window.location.pathname;
var required_loc = "/support/catalog/items/103";
if (current_loc == required_loc) {
$("#103_8af78d5d-1e4d-4e20-b177-0f1441e3ac8b").change(function () {
var input_field = $(this).val();
let text = $(this).val();
let pattern = /^[a-zA-Z]{3}$/;
let result = pattern.test(text);
if (result == false) {
<!-- Show error message under field -->
$('#error-roles').remove();
var errorMsg = "Invalid value entered. Please enter max 3 letters";
var span = document.getElementById("103_8af78d5d-1e4d-4e20-b177-0f1441e3ac8b");
var errElem = document.createElement("div");
errElem.setAttribute("class", "error");
errElem.setAttribute("id", "error-roles");
errElem.textContent = errorMsg;
span.after(errElem);
} else {
$('#error-roles').remove();
}
});
}
}, 300);
});
</script>

 

How does this look like in the portal?

 

 

Kind regards,

 

Rutger Bockholts

Freshworks


msconfig87
Top Contributor ⭐
Forum|alt.badge.img+10
  • Top Contributor ⭐
  • September 6, 2023

Oh wow, what an abomination of a workaround 😆.

Rutger, you work at FreshWorks? I want to quickly state constructive criticism:
On a high level I am very satisfied on the broad functionality FreshService offers. But as soon as we go into details with real use cases, it seems that the developers are lacking time or patience.

Every time a new feature gets implemented, I notice that its not fully tested and only works half way and then takes a long time to get fixed or will not be fixed at all (one example: in workflows there are only limited fields available for actions whereas in other nodes there are more, but you can never select the full palette of fields like you would have in the API.. there is no valid reason for this limitation other than no time to implement - why not do it right from the beginning)

So here this feature request is about “input validation” which in my opinion is one of the first things a programmer learns in his career. So instead of offering a fully functional input validation on the Service Item level FreshWorks somehow decided to only offer Business Rules on a higher level. But then again there is only a limited set of functionality implemented there and the customer has to build wild workarounds to get industry default.

Don’t get me wrong, I like the product and also the high pace of features getting implemented every month. But you clearly need to get better on:

  • testing
  • Think things through to the end
  • thinking in real life use cases

thanks  😉


Rutger Bockholts
Community Debut
Forum|alt.badge.img+4

Hi @msconfig87 Thank you for your feedback. I'll take this offline with you, since your feedback is really appreciated but not directly relevant for this topic.

 

Rutger


afautley
Top Contributor ⭐
Forum|alt.badge.img+11
  • Top Contributor ⭐
  • September 8, 2023

Agree with MsConfig here. 

just to say it would be nice if Freshworks have a “usability” team in there testing department as the usability of the product needs a lot of work. 


paulroberts89
Top Contributor ⭐
Forum|alt.badge.img+5
  • Author
  • Top Contributor ⭐
  • August 23, 2024

Shame this one hasn’t gained anymore traction - really feels like a big gap for us in being able to make smarter forms. Also allow control of the date picker to insert restrictions (like no dates in the past!)


Forum|alt.badge.img
  • Apprentice
  • March 11, 2026

I have never seen a modern system not have validation capability on fields. This is a HUGE problem for us. Please consider form field validation rules in upcoming releases!