Service Desk Practitioners Forum
cancel
Showing results for 
Search instead for 
Did you mean: 

restrict field length in forms

Highlighted
Geert Van Riet
Occasional Contributor

restrict field length in forms

Hi,

In the forms used for our CMDB we want to apply some logic to force users to add data according to our defined naming conventions. For instance, we have some attributes that cannot be longer than 20 characters because we interface this data to other systems also, which has a restriction of 20 characters for this field.
What we conclude now is that we cannot apply any GUI rule to limit a 40-character text field (min length in SD) to use only 20 characters for instance!!
For us, this is really base functionality of a product and it seems not possible in the SD client.

If it IS possible to do such things for fields, can anyone tell me how you do this in SD? Or does anyone know if this is going to be future functionality?

Thanks for any reply!

regards,
Geert
1 REPLY
Gyula Matics_1
Honored Contributor

Re: restrict field length in forms

The only solution I can see is to use two UI rules. One to count the number of characters in that lenght limited attribute and store it in a number type custom field. And the second rule to be run before the item is saved, compares this value with 20, and if larger, prevents the item from beeing saved.

1:
When a value has changed
where NOT( XXXX(*) is empty)
z (Update Data) XXXX_characters set to (Count characters from [XXXX])

2:

Before the item is saved
where XXXX_characters is more than 20
error (User Notification Message)
//Add this to "OnDomLoad" event