Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Why setLabelOf() function is not allowing below code to run in the onload script?

Apoorva A H
Tera Contributor

Hii All,

My question is about related to the setLabelOf() function, As i came across that i have used setLabelof() for one field to relabel it then it worked but below code was not running then i commented the code of setLabelof() then below code was running fine, Can i know what is the reason why it is happening like that?

6 REPLIES 6

Community Alums
Not applicable

Hi @Apoorva A H ,

Please check below code 

function onLoad() {
    //Type appropriate comment here, and begin script below
    g_form.setLabelOf('description', "label name");
	var view = getView();
	
    if (view == 'my_new_view') {
		alert(view);
        g_form.setVisible("active", true);
        g_form.setVisible('priority', false);
    }
}

 

I gone with documentation of client scirpt api, mentioned as instead of setDisplay or setVisible method you can create UI Policy for that 

SarthakKashyap_0-1725868198904.png

 

Please mark my answer correct and helpful if this works for you

Thanks and Regards 
Sarthak

Community Alums
Not applicable

Hi @Apoorva A H ,

Can you please mark my answer correct if this works for you

 

Thanks and Regards 
Sarthak