How to dynamically change the title of a UI Action from an onchange client script?

peterraeves
Mega Guru

ServiceNow dynamically changes the label for the additional comments field to contain the text 'customer visible'. I created something similar for work notes, but what about UI Actions? Can we dynamically modify it's text form an onchange client script?

1 ACCEPTED SOLUTION

I am not proud of what I did, but I solved it by using the following code



var action_name = '<action name of the UI Action';


var label = '<some label>';


var selector = 'button#' + action_name;


$j(selector).each(function(){


  $j(this).html(label);


});


View solution in original post

3 REPLIES 3

divya mishra
Tera Guru

Hey Peter,



I doubt you can do that and ofcourse set label can be done on the field level. But in order meet your requirement you can create another button and set the conditions accordingly for the visibility.



Let me know if you need any help there


post me your feedback, boosts me further to help more


Please Hit ✅Correct, ��Helpful, or ��Like depending on the impact of the response


Have a lovely day ahead




Regards,


Divya Mishra


I am not proud of what I did, but I solved it by using the following code



var action_name = '<action name of the UI Action';


var label = '<some label>';


var selector = 'button#' + action_name;


$j(selector).each(function(){


  $j(this).html(label);


});


sachin_namjoshi
Kilo Patron
Kilo Patron

You can do GlideAjax from your client script.


In you GlideAjax script include, you can do GR to sys_ui_action table   and update UI action name.



REgards,


Sachin