- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2023 08:07 AM - edited 05-05-2023 09:48 AM
Hi,
We want to set the label for journal type field called internal work. Internal work value we are passing to work notes field. And Internal work will show all previous entries. Now we want to show the label "history" for all entries. tried below code but not working. can anyone have a look and suggest any modifications ?
function onLoad() {
var tableName = g_form.getTableName();
var recordSysId = g_form.getUniqueValue();
var checkWN = new GlideRecord('sys_audit');
checkWN.addQuery('documentkey', recordSysId);
checkWN.addQuery('tablename', tableName);
checkWN.addQuery('fieldname', 'work_notes');
checkWN.query();
alert("hi");
if (checkWN.next()) {
var wn = g_form.getFormElement('element.x_123_table.internal_work').querySelector("div[id='element.x_123_table.internal_work'] > div[class*='input_controls']");
if (wn)
wn.insertAdjacentHTML('beforebegin', '<div style= "font-size:15px ; margin: 0px 0px 0px 15px">Internal Work History</div>');
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2023 11:58 PM
I have removed the GlideRecord query in onload script and created Script include and return the "true" value .
Now i'm able to see the Label for all journal entries.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2023 10:05 AM
Hi @Rakesh50 ,
Hope you are doing well.
g_form.setLabelOf('your field name', 'Text');
As checked you have user GlideRecord API in client script and it is not recommended could you please glideAjax instead.
Please mark this response as correct or helpful if it assisted you with your question.
Regards,
Harshal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2023 10:15 AM
Thanks for the reply. I'm doing good.
If I use setLabelOf, it will show the all entries with label. But I required like below
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2023 11:58 PM
I have removed the GlideRecord query in onload script and created Script include and return the "true" value .
Now i'm able to see the Label for all journal entries.