Resizing a field using client script

LivashanN
Tera Contributor

Hi Everyone, 

 

Would just like to find out with regards to data displaying outside of a field that has been resized.

So we have a sensitive data field that we are using and when switched to Next experience the field was much larger than it was in UI16, we then added a client script that resized the field.

 

We had reports from some users afterwards that the data in the field was not truncating in the field so it was filling the field and then displaying outside if the field, however this was only happening to certain users but for everyone else it was displaying properly with a scroll bar in the field for the rest of the information.

 

Does anyone know what could cause this or how we could possibly fix this?

4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

@LivashanN 

why are you not using encryption for this i.e. CLE which is free plugin and ensure only users having encryption context can access that?

You can encrypt String text, Date and Date/Time fields, attachments, and URLs.

Column Level Encryption 

I won't rely on the resize logic as it may or may not work in future considering users can use Chrome, Edge, Firefox etc browsers.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

So only people that should see the field can see the field so that is working correctly as it should, the only issue we face is that the field is visibly larger in Next experience compared to what it was in UI16, so to fix that we added a script just to change the size of the field visually on the form.

 

But from the correct individuals that should have access to see this field instead of the data all remaining in the field with a scroll bar if there is more data than the size of the field, it displays some of the data inside the field and some outside.

 

So for some people that are supposed to see the data it is working correctly but for some it does not, the one difference that was noted is a role between the individuals.

 

I hope im making sense.

@LivashanN 

how are you hiding it? are you using encryption or some custom logic to mask the value in that field?

share that script and config screenshots and the screenshots from both the users

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

It is using encryption to mask the value, it is a encrypted field

 

Below is the script that was created to run on task table so it extends to the child tables.

 

function onLoad() {

 

    var myField = 'field_name';

    var ctrl = g_form.getControl(myField);

 

    ctrl.style.width = '300px';

 

    ctrl.style.height = '50px';

}

 

Screenshots will try and get some cause the use cases that we have contain sensitive data that cant be shared