- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2022 01:19 AM
How to get the value of Label of a Table at client side ?
The backend name of Label Field is 'label' only. To get table name we have g_form.getTableName(). How to get the table label name as shown in below scrrenshot. Please suggest
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2022 02:44 AM
Well, if you want to change the header title then you might have to use DOM which is not recommended.
For this purpose, we have type field on the form, right?
If you still want to go with DOM, then try utilizing the below scripts on change_request table.
Display Business Rule.
(function executeRule(current, previous /*null when async*/ ) {
var chgType = current.type.getDisplayValue();
var tblName = current.getClassDisplayValue();
g_scratchpad.title = chgType + ' ' + tblName;
})(current, previous);
onLoad() Client Script
function onLoad() {
var arr = top.document.getElementsByClassName('navbar-title-caption');
arr[0].innerHTML = g_scratchpad.title;
}
Output:
In case, if it does not work then you can uncheck Isolate script check box in the client script and try again. See the below image for reference.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2022 01:42 AM
can you share the screenshot of your BR and Client script?
Thanks
Harshad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2022 01:47 AM
On Display BR :
var ticktype = current.ticket_type.getDisplayValue();
var tb_name = current.getClassDisplayValue();
var tab_label = ticktype + " " + tb_name;
g_scratchpad.test = tab_label;
On Load CS :
alert(g_scratchpad.test);
g_form.setLabelOf('label', g_scratchpad.test);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2022 02:09 AM
Can you explain your business requirement like why there is need of table label ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2022 02:12 AM
So that by opening the record one can easily identify the type of Change Request by reading out at Form Header
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2022 02:34 AM
Well, if you want to change the header title then you might have to use DOM which is not recommended.
For this purpose, we have type field on the form, right?
If you still want to go with DOM, then try utilizing the belows scripts on change_request table.
Display Business Rule.
(function executeRule(current, previous /*null when async*/ ) {
var chgType = current.type.getDisplayValue();
var tblName = current.getClassDisplayValue();
g_scratchpad.title = chgType + ' ' + tblName;
})(current, previous);
onLoad() Client Script.
function onLoad() {
var arr = top.document.getElementsByClassName('navbar-title-caption');
arr[0].innerHTML = g_scratchpad.title;
}
Output: