How to change the filed label when other field value changes

Kirankumar Nal1
Tera Contributor

Hi,

Would like to change the label for a field when the other field values changes in Form View.

Please suggest on this.

 

Thank you

Kirankumar Nalla

1 ACCEPTED SOLUTION

Maik Skoddow
Tera Patron
Tera Patron

Hi

I cannot recommend this. Labels should stay consistent in all experiences (UI16, Service Portal, Workspaces, Mobile Apps). As a user, I would be irritated if a field label changes unexpected.

So maybe you explain better the underlying business requirement and don't ask for a special solution.

Kind regards
Maik

View solution in original post

2 REPLIES 2

Maik Skoddow
Tera Patron
Tera Patron

Hi

I cannot recommend this. Labels should stay consistent in all experiences (UI16, Service Portal, Workspaces, Mobile Apps). As a user, I would be irritated if a field label changes unexpected.

So maybe you explain better the underlying business requirement and don't ask for a special solution.

Kind regards
Maik

NS16
Mega Sage

Hi @kirankumar, 

You can write UI policy.

1) Add your condition in the condition field of UI policy

2) In the Script section add below code in the Execute if true section.

e.g.

g_form.setLabelOf('short_description', 'Problem Statement')

OR

You can write on change client script.

e.g.

function onChange(control, oldValue, newValue, isLoading) {
if (isLoading) {
return;
}
if (g_form.getValue('request_type') == 'Create') {
g_form.setLabelOf('phone', 'New Phone');
g_form.setLabelOf('address', 'New Address');
}
else {
g_form.setLabelOf('phone', 'Phone');
g_form.setLabelOf('address', 'Address');
}
}

Thanks,
Neha

Please mark helpful/correct.