We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

Can't change Text align and Direction of text fields (Variables in Catalog Item)

RonAlmog
Tera Contributor

Hello, I am clarifying my previous question - 

I have some single/multi line text fields which are variables in a catalog item.

I want the text inside of them to be text-align 'right' and direction 'rtl'.

I tried resolving it through a client script or a style, both didn't work.

 

I'd appreciate any kind of help.

 

Thanks

Ron

2 REPLIES 2

Sandeep Rajput
Tera Patron

Amit_Kirpane
Tera Contributor

Hi @RonAlmog,

 

You can try the onLoad client script and modify it as required!

function onLoad() {
    var myField = 'u_od'; //field value
    var ctrl = g_form.getDisplayBox(myField);

    if (!ctrl) {
        ctrl = g_form.getControl(myField);
    }
    console.log('Control:', ctrl);
   
    if (ctrl) {
        ctrl.style.textAlign = 'left';
    } else {
        console.error('Control not found for field:', myField);
    }
}