g_form.setLabelOf in onLOAD_record

Ni_a Sy
Tera Contributor

Here is my code:

g_form.setLabelOf('postal_address', 'Postal address');
var test = g_form.getField('postal_address');
test.help_text = 'Address to where invoice should be deliver';
 but it is not working. I need to work on a script not data dictionary.  I tried to put the code at console and found error. Please Help I just waNt to change the  LABEL NAME and the BLUE MESSAGE.

Screenshot 2023-03-01 173027.pngScreenshot 2023-03-01 173948.png

8 REPLIES 8

Ankur Bawiskar
Tera Patron
Tera Patron

@Ni_a Sy 

you want to change the label of field or variable?

 

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

Just label of the field and the blue message there.

@Ni_a Sy 

it's a variable and not field

you cannot change the help text dynamically using any OOB function.

You can show field message below that variable using g_form.showFieldMsg('variableName', 'Your Message');

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

instead of Postal address (if delivery address differs from the address on billing document)  I want to make it Postal address. Instead of Complete only in case the billing document needs to be sent physically to different address than the Bill-to-party address (BTP = the address shown on the billing document PDF) I want it change it to Address to where invoice should be deliver. Using code:
g_form.setLabelOf('postal_address', 'Postal address');
var test = g_form.getField('postal_address');
test.help_text = 'Address to where invoice should be deliver';

Screenshot 2023-03-01 181311.png